-
-
Save edward/19899 to your computer and use it in GitHub Desktop.
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 make_sandwiches(however_many) | |
sandwiches = [] | |
however_many.times do | |
sandwiches << make_sandwich { |sandwich| yield sandwich } | |
end | |
sandwiches | |
end | |
def make_sandwich | |
puts "makin a sandwich" | |
yield | |
puts "done" | |
puts | |
end | |
make_sandwich do | |
puts "peanut" | |
puts "butter" | |
puts "jelly" | |
puts "time" | |
end | |
make_sandwiches(3) do | |
puts "bacon" | |
puts "hamburger" | |
puts "bacon" | |
puts "cheese" | |
puts "bacon" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment