Kotlin infers the type of variable from the value assigned to it. In the following example, intVariable is assigned a type of Int:
//Type Inference
var intVariable = 10
Since Kotlin is type-safe, the following snippet will result in a compilation error if uncommented:
//intVariable = "String"
//If uncommented -> Type mismatch:
//inferred type is String but Int was expected