String variable
var myVar="Hello world"
var myVar:String
myVar="Hello World"
Integer variable
var MyVar=10
Decimal/Float variable
var myVar=1.0
For constant value variable
val myVar="Helloworld"
myVar="is not changed"
print(myVar)→output is Helloworld
Ranges
Using Double dots
val Myvar=1..10 // ranges from 1,2,3,4,.....9,10
val Myvar=1.rangesTo(10) // ranges from 1,2,3,4,.....9,10
Using downTo
val Myvar=10 downTo 1 //ranges from 10,9,8,7...3,2,1
val Myvar=10.downTo(1) //ranges from 10,9,8,7...3,2,1
Using steps
val Myvar=10 downTo 1 step 2 // ranges fro 10,8,6,4,2
Using alphabets
val Myvar="a"..."z" //ranges from a,b,c,d,.....z
val Myvar='a'...'z' //ranges from a,b,c,d,.....z
Checking a value in range variable
var MyvarinMyvar='a' in Myvar //checking...