Created
July 27, 2012 05:03
-
-
Save ananfang/3186253 to your computer and use it in GitHub Desktop.
The yield statement: yield with paremeters
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 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