Skip to content

Instantly share code, notes, and snippets.

@EdDeAlmeidaJr
Created May 14, 2016 22:28
Show Gist options
  • Save EdDeAlmeidaJr/9f69a9f65b9bbdbc7cb5edf3d5b513ee to your computer and use it in GitHub Desktop.
Save EdDeAlmeidaJr/9f69a9f65b9bbdbc7cb5edf3d5b513ee to your computer and use it in GitHub Desktop.
Example of the behavior of a Ruby method defined inside other method
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