Created
November 19, 2012 08:05
-
-
Save richo/4109520 to your computer and use it in GitHub Desktop.
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
col = [1, 2, 3] | |
some_value = 0 | |
col.each do |i| | |
val = "thing" | |
some_value = i | |
end | |
begin | |
puts val | |
rescue NameError | |
# val not defined in this scope | |
end | |
puts some_value | |
for i in col | |
val = "thing" | |
some_value = i | |
end | |
puts val | |
puts some_value |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
outputs:
Try removing the begin..rescue :)