Last active
June 30, 2021 04:44
-
-
Save JuzerShakir/bb68f76977a68515c946ea1584343ed5 to your computer and use it in GitHub Desktop.
Local Variable medium
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
local_var = "I am local var defined in root." | |
puts local_var # => "I am local var defined in root." | |
# accessing local var which is defined in root | |
def access | |
puts local_var # => NameError | |
end | |
# accessing variable in nested method | |
def parent_method | |
local_var = "I am local var defined in a method." | |
def child_method | |
puts local_var # => NameError | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment