curric

View on GitHub

./curric/kotlin/basics/variables/

Variables

Variables can be declared two different ways. val or var. Depending on if the variable is val or var, the variable will behave differently.

The type of the variable in Kotlin can be either explicitly given or the type can be inferred. To explicitly define the type, place a : after the variable name and then the type.

var name: Type

Val vs Var