How kotlin program is executed internally:

Screenshot 2023-01-13 015946.jpg

Variables:

var x = 5 // `Int` type is inferred
x += 1

println(x::class) // prints the class whether it is a int, string, double etc
val a: Int = 1  // immediate assignment
val b = 2   // `Int` type is inferred
val c: Int  // Type required when no initializer is provided
c = 3       // deferred assignment

DataTypes:

fun main() {
var name = "Donn"
var age = 32

println("Hello $name, your age is $age and your name is ${name.tength} characters long.") 
// use {} to include method

Nullable Types:

		var demo1 : String= "balu"
    demo1 = null // error

		// To make a variable accept null value add ?
    
    var demo2 : String? = "Balu"
    demo2 = null

Conditionals:

// no need of swicth statements
when (n) {
    1 -> {
        print("First")
        // run your code
    }
    2 -> print("Second")
    3, 4 -> print("Third or Forth") // check multiple conditions for same code
    in 1..100 -> print("Number is in the range")
    else -> {
        print("Undefined")
    }
}

Loops: