I have a situation where I have to make a check like this:
if foo == a || foo == b || foo == c {
//do stuff
}
is there any way to chain these operands into something smaller like IDK
foo == a||b||c
I have a situation where I have to make a check like this:
if foo == a || foo == b || foo == c {
//do stuff
}
is there any way to chain these operands into something smaller like IDK
foo == a||b||c
Try this:
if [a, b, c].contains(foo) {
//do stuff
}