can I pass a Pair inside a when(condition) ?
# getting-started
i
can I pass a Pair inside a when(condition) ?
s
You can do
Copy code
when {
case1 && case2 -> foo
case1' && case2' -> bar
}
i
Cool and simple
I am going to try
Does not work
because with && the case1 and case 2 become boolean
while instead are Strings
s
Then do as @karelpeeters says in the other thread
i
does not work
f
Have you tried a comma? case1, case2 -> foo
k
That's "or", not sure if that's what he wants here.
f
Indeed, you are right.