-
-
Save edward/19899 to your computer and use it in GitHub Desktop.
Revisions
-
guenin created this gist
Oct 26, 2008 .There are no files selected for viewing
This file contains hidden or 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 charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,29 @@ 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