Skip to content

Instantly share code, notes, and snippets.

@megstang
Created August 19, 2020 04:01
Show Gist options
  • Save megstang/258b44b1ceb30d22d1df7a0c39bb0d63 to your computer and use it in GitHub Desktop.
Save megstang/258b44b1ceb30d22d1df7a0c39bb0d63 to your computer and use it in GitHub Desktop.
Argument Scope Examples 10-13

Example 10

def print_variable(x)
puts x
end

print_variable(4)

Example 11

def print_variable(x)
  puts x
end

x = 4
print_variable(x)

Example 12

def print_variable(x)
  puts x
end

print_variable(2)
puts x

Example 13

def print_variable(x)
x = 4
puts x
end

print_variable(2)
puts x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment