Created
July 2, 2015 11:47
-
-
Save guiman/d83baaa0bdff58e97d82 to your computer and use it in GitHub Desktop.
Ruby 2.1.4 defines variables on unexecuted if block conditions
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ irb | |
irb(main):001:0> that | |
NameError: undefined local variable or method `that' for main:Object | |
from (irb):1 | |
from /Users/guiman/.rbenv/versions/2.1.4/bin/irb:11:in `<main>' | |
irb(main):002:0> (true) ? this = "a" : that = "b" | |
=> "a" | |
irb(main):003:0> that | |
=> nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment