Created
December 2, 2011 01:56
-
-
Save dlt/1421359 to your computer and use it in GitHub Desktop.
Why is 'y' defined?
This file contains 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
ruby-1.9.2-p180 :001 > if 1 then x = 1 else y = 0 end | |
=> 1 | |
ruby-1.9.2-p180 :002 > y | |
=> nil | |
ruby-1.9.2-p180 :003 > x | |
=> 1 | |
ruby-1.9.2-p180 :004 > z | |
NameError: undefined local variable or method `z' for main:Object | |
from (irb):4 | |
from /home/dlt/.rvm/rubies/ruby-1.9.2-p180/bin/irb:16:in `<main>' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment