Created
September 1, 2011 22:34
-
-
Save whitethunder/1187487 to your computer and use it in GitHub Desktop.
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
ree-1.8.7-2011.03 :001 > a | |
NameError: undefined local variable or method `a' for #<Object:0x3466218> | |
from (irb):1 | |
ree-1.8.7-2011.03 :002 > if false | |
ree-1.8.7-2011.03 :003?> a = 1 | |
ree-1.8.7-2011.03 :004?> end | |
=> nil | |
ree-1.8.7-2011.03 :005 > a | |
=> nil |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It does it for nil too, although maybe that is expected?
irb(main):001:0> a
NameError: undefined local variable or method `a' for main:Object
from (irb):1
from :0
irb(main):002:0> if nil
irb(main):003:1> a=1
irb(main):004:1> end
=> nil
irb(main):005:0> a
=> nil
irb(main):026:0> false.object_id
=> 0
irb(main):027:0> true.object_id
=> 2
irb(main):028:0> nil.object_id
=> 4