Last active
October 8, 2019 20:21
-
-
Save choallin/800ed8a7d966b260b020e0e3c54eaab2 to your computer and use it in GitHub Desktop.
dynamical_scoping
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 multiply_by_two | |
multiplicand = 2 | |
test_method | |
end | |
def multiply_by_three | |
multiplicand = 3 | |
test_method | |
end | |
def test_method | |
different_variable = [1,2,3] | |
different_variable.map do |number| | |
number * multiplicand | |
end | |
end | |
puts multiply_by_two # => [2,4,6] | |
puts multiply_by_three # => [3,6,9] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment