Kotlin Variables
$count++; if($count == 1) { include "../mobilemenu.php"; } if ($count == 2) { include "../sharemediasubfolder.php"; } ?>
There are two types of declaration in Kotlin.
1. val - once declared it cannot be changed.
2. var - once declared it can be changed.
val syntax is:
val varname: Datatype = value
var syntax is:var varname = value
or we can also specify a datatype.var varname: Datatype = value
Let us look at some examples.1. Declaration of an integer val.
val a: Int = 3
You need not declare the data type. Kotlin can infer the data type based on what it sees on right hand side.
2. Example for non declaration.
val a = 1
If you are not initializing, but only declaring, you must provide the type.val a: Int
You must provide type in above scenario as Kotlin cannot infer.