when {
firstVal in 1..2 -> TODO()
secondVal == "a" &&
secondVal.someOtherProp =="b" -> TODO()
}
If you don’t specify a variable on a when it just becomes a sequentially evaluated set of rules where the first satisfied condition matches and terminates the evaluation. Basically equivalent to an if(...) {...} else if (...) {...} else if (...) {...} else {...} chain.