The website uses cookies to optimize your user experience. Using this website grants us the permission to collect certain information essential to the provision of our services to you, but you may change the cookie settings within your browser any time you wish. Learn more
I agree
Summary | 7 Annotations
In Kotlin, if is an expression,
2017/09/16 15:31
// As expression val max = if (a > b) a else b
2017/09/16 16:06
if branches can be blocks, and the last expression is the value of a block:
2017/09/16 16:08
If when is used as an expression, the else branch is mandatory, unless the compiler can prove that all possible cases are covered with branch conditions.
2017/09/16 16:12
when (x) { 0, 1
2017/09/16 16:12
for iterates through anything that provides an iterator, i.e. has a member- or extension-function iterator(), whose return type has a member- or extension-function next(), and has a member- or extension-function hasNext() that returns Boolean.
2017/09/16 16:16
when (x) { parseInt(s)
2017/09/17 04:40