Skip to content

Instantly share code, notes, and snippets.

@ananfang
Created July 27, 2012 04:54
Show Gist options
  • Save ananfang/3186238 to your computer and use it in GitHub Desktop.
Save ananfang/3186238 to your computer and use it in GitHub Desktop.
The yield statement: Block associates to method call
# Associate to a method call with no parameter
just_say_hi { puts 'Hi!'}
# Associate to a method call with parameters
say_hi_to('Andy') { puts 'Hi!' }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment