Another silly coding error

20-Apr-2017 4806
See the bug? I had intended to call do_something if foo was either "bar" or "buz". But what I was actually doing was only checking if foo was "bar", because "bar" || "buz" is an expression that evaluates to the first non-nil literal, "bar". So the "buz" alternative was never being checked. I should have been using a variable arguments splat-ish thing:.
Use coupon code:

RUBYONRAILS

to get 30% discount on our bundle!
Prepare for your next tech interview with our comprehensive collection of programming interview guides. Covering JavaScript, Ruby on Rails, React, and Python, these highly-rated books offer thousands of essential questions and answers to boost your interview success. Buy our 'Ultimate Job Interview Preparation eBook Bundle' featuring 2200+ questions across multiple languages. Ultimate Job Interview Preparation eBook Bundle