Skip to content

Instantly share code, notes, and snippets.

@goodside
Created July 22, 2010 02:00
Show Gist options
  • Save goodside/485461 to your computer and use it in GitHub Desktop.
Save goodside/485461 to your computer and use it in GitHub Desktop.
>> if (foo || true) then 'Hi' else 'Bye' end
NameError: undefined local variable or method `foo' for main:Object
from (irb):1
>> foo = nil
=> nil
>> if (foo || true) then 'Hi' else 'Bye' end
=> "Hi"
>> foo = false
=> false
>> if (foo || true) then 'Hi' else 'Bye' end
=> "Hi"
>> if (foo == false) then 'Hi' else 'Bye' end
=> "Hi"
>> foo = nil
=> nil
>> if (foo == false) then 'Hi' else 'Bye' end
=> "Bye"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment