Last active
August 29, 2015 14:25
-
-
Save amatsuda/469302f6440ac9fa4ae3 to your computer and use it in GitHub Desktop.
I do understand what's happening, but...
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
if false | |
a = 2 | |
p a | |
else | |
Proc.new do |a| | |
p a | |
end | |
end |
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
if true | |
Proc.new do |a| | |
p a | |
end | |
else | |
a = 2 | |
p a | |
end |
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
% ruby -w shadowing_outer_local_variable.rb | |
shadowing_outer_local_variable.rb:5: warning: shadowing outer local variable - a | |
% ruby -w not_shadowing_outer_local_variable.rb | |
(No warning!) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment