Created
May 14, 2016 22:28
-
-
Save EdDeAlmeidaJr/9f69a9f65b9bbdbc7cb5edf3d5b513ee to your computer and use it in GitHub Desktop.
Example of the behavior of a Ruby method defined inside other method
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 alfa | |
alfa_variable = 1 | |
def beta | |
beta_variable = 2 | |
puts 'Method beta' | |
end | |
puts 'Method alfa' | |
puts alfa_variable | |
beta | |
puts beta_variable | |
end | |
alfa | |
puts alfa_variable | |
beta | |
puts beta_variable |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment