July 2018
Intermediate to advanced
242 pages
8h 6m
English
Similarly, we can treat other language declarations as expressions. It's a common practice to assign a variable to the value returned by control flow statements, such as if and when. For example, we can use when as an expression in the following way:
val result = when(input) { is Int -> input is String -> parseInt(input) else -> 0}
Read now
Unlock full access