July 2018
Intermediate to advanced
336 pages
9h 23m
English
The when statement here is the same as Java's switch statement, but with concise code as follows:
var word : String = when(letter) { "A" -> "Apple"; "B" -> "Ball"; "C" -> "Cat"; "D" -> "Dog"; else -> "Don't Know";}
The else keyword is used to specify default values in case no match is found.
Read now
Unlock full access