Skip to content

Instantly share code, notes, and snippets.

@tmaeda
Created September 6, 2011 10:24
Show Gist options
  • Save tmaeda/1197204 to your computer and use it in GitHub Desktop.
Save tmaeda/1197204 to your computer and use it in GitHub Desktop.
def foo()
puts "foo"
yield
end
a = 1
>> foo{ puts a; a += 1;}
foo
1
=> 2
>> foo{ puts a; a += 1;}
foo
2
=> 3
>> foo{ puts a; a += 1;}
foo
3
=> 4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment