What’s the most concise way to ensure three variables are all equal in ruby? For example
dog = 'animal'
cat = 'animal'
chicken = 'animal'
shoe = 'clothing'
# Something like this...which doesn't work
dog == cat == chicken # true
dog == cat == shoe # false
The most concise way for three elements is (sorry to disappoint you):
Of course you can always get clever if you want to…
…but that doesn’t really make the code more concise (or readable).
I would do something like this if you want a reusable function that can compare arbitrarily many elements for equality: