This is more a matter of semantics than anything else.
I want to check if a variable is one of two values. The easiest way to do this:
if var == "foo" || var == "bar" # or if var == 3 || var == 5
But for me this is not very EXISTING. I know that I can use String.match() , but this does not work for non-string variables and is three times slower.
Is there a better way to check a variable for two values?
source share