Another silly coding error

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:.
Another silly coding error #ruby #rails #rubyonrails #bosnia #programming #tutorials #rubydeveloper #railsdeveloper

Nezir Zahirovic

Freelance software developer Ruby On Rails (4 years) / MCPD .Net / C# / Asp.Net / CSS / SQL / (11 years)

related articles