Kotlin is a modern programming language developed by JetBrains and officially supported for Android development by Google. It is known for its concise syntax, interoperability with Java, and strong support for functional programming concepts.

Entry Point: Main Function

In Kotlin, when writing purely Kotlin applications, the main function serves as the entry point. It is where the execution of the program begins:

kotlinCopy code
fun main() {
    // Code goes here
}

The fun keyword is used to define functions in Kotlin, making it straightforward to declare and call functions within your program.

<aside> 💡 Rules Name of function should and program should be in camelCase and a verd

</aside>

Variables and Data Types

Variables in Kotlin are defined using the var and val keywords, where var declares mutable variables (those whose values can change) and val declares immutable variables (constants).

Data Types

Kotlin supports various data types, including:

Example Usage:

kotlinCopy code
fun main() {
    val message: String = "Hello, Kotlin!"  // Declaring an immutable string variable
    var count: Int = 10                    // Declaring a mutable integer variable
    val pi: Double = 3.14159               // Declaring an immutable double variable
    val isActive: Boolean = true           // Declaring an immutable boolean variable

    println(message)
    println("Count: $count")
    println("Pi: $pi")
    println("Is Active? $isActive")
}

In this example: