Skip to content

Instantly share code, notes, and snippets.

@ananfang
Created July 27, 2012 05:03
Show Gist options
  • Save ananfang/3186253 to your computer and use it in GitHub Desktop.
Save ananfang/3186253 to your computer and use it in GitHub Desktop.
The yield statement: yield with paremeters
def who_loves_who
yield('Openchan', 'Chikuwa')
end
who_loves_who do |boy, girl|
puts "#{boy} loves #{girl}"
end
# Results:
#
# Openchan loves Chikuwa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment