Is there a concise way to pattern match on a value...
# getting-started
c
Is there a concise way to pattern match on a value and check if it is a member of multiple collections? I would like to write this, but it’s not valid syntax. (Adding the lists together would make sense in this example, but not in the real code).
Copy code
when (someValue) {
  in list1 && in list2 -> TODO()
}
Or do I have to write it like this?
Copy code
when {
  someValue in list1 && someValue in list2 -> TODO()
}
🤔 1
For clarity, the real code has lots of cases where it checks membership in a bunch of collections.
And the ”or” variant would be possibe with:
Copy code
when (someValue) {
  in list1, in list2 -> TODO()
}
But I need the ”and” 😁
e