October 2018
Intermediate to advanced
370 pages
9h 15m
English
Range provides two properties that allow us to access the first element of a range:
val myRange = 1..10 println("first " + myRange.first)println("start " + myRange.start)
first and last properties are pretty much same, behind the scene start property calls first property.
It also provides two properties that allow us to access the last element of a range:
println("last " + myRange.last)println("endInclusive " + myRange.endInclusive)
In these examples, the first block of code will return 1 and the second block of code will return 10.
Read now
Unlock full access