3 ms·
does ruby do anything like this? i'm new to ruby and could imagine something like this biting me ...
by breatheoften 6y ago
does ruby do anything like this? i'm new to ruby and could imagine something like this biting me ...
- mpd 6y agoYes. Check out the differences between `&&` vs. `and`, along with `or` vs. `||`, which can lead to similar surprises. Though you can skip this lesson if you've worked with Perl (any others?) in the past.
- willbutler 6y agoI agree with the folks at Airbnb regarding the and, or, and not keywords. "It's just not worth it." [1]. [1] https://github.com/airbnb/ruby#no-and-or https://github.com/airbnb/ruby#no-and-or
- jes5199 6y agonot really. there’s some weird operator precedence, but it doesn’t have any multi-operator expressions
- waffle_ss 6y agoOne weird operator that comes to mind is the flip-flop operator, but the odds of encountering it are close to zero, and it would certainly stick out as something very bizarre and not confused with other syntax. https://chrisseaton.com/truffleruby/flip-flops/ https://chrisseaton.com/truffleruby/flip-flops/
- jes5199 6y ago!?! I’ve been working in ruby for 15 years and I had never heard if the flip flop operator! Amazing. Thanks for the counter-example, I have learned something