Created
May 11, 2012 23:45
-
-
Save polotek/2663147 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
def foo | |
bar = "bar" | |
arr = [1, 2, 3] | |
arr.map {|a| | |
fizz = "buzz" + a.to_s | |
# this line is fine, blocks can access the enclosing scope | |
print bar + "\n" | |
} | |
# this throws, fizz is only defined within the local block | |
print fizz | |
end | |
foo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment