Basics
Kotlin is a statically-typed language.
This means that the variable type is resolved at compile time and never changes.
Program entry point
An entry point of a Kotlin application is the main function:
Another form of main accepts a variable number of String arguments:
Functions
A function with two Int parameters and Int return type:
A function body can be an expression. Its return type is inferred:
A function that returns no meaningful value:
Unit return type can be omitted:
Variables
The val keyword is used to declare immutable, read-only local variables that can’t be reassigned a different value after initialization.
The var keyword is used to mutable variables, and their values can be changed after initialization.
Kotlin supports type inference and automatically identifies the data type of a declared variable.
Variables can also be declared and initialised separately