Wahib
06/26/2018, 10:14 PMwhen
on a pair
type? Finding it a bit difficult to make it work.
Something like:
val pair: Pair<StatusAType, StatusBType> = ...
when(pair) {
is (StatusA, StatusB) -> {
}
}
It is showing an error Type Expected
in IDEsnowe
06/26/2018, 10:37 PMjon.peterson
06/26/2018, 11:00 PMpair.first is StatusA && pair.second is StatusB
?Wahib
06/27/2018, 12:21 AMWahib
06/27/2018, 12:21 AMAndreas Sinz
06/27/2018, 7:24 AMwhen
(yet?)Wahib
06/27/2018, 8:09 AMzip
operatorWahib
06/27/2018, 8:21 AMPair(x, y)
is possible with when
?
when(obj) {
Pair("a", 10) -> ...
Pair("c", 13) -> ...
else -> ...
}
https://discuss.kotlinlang.org/t/destructuring-in-when/2391louiscad
06/27/2018, 8:56 AMto
infix extension function in when
branches