From: Robert Klemme Date: 2009-12-09T02:55:09+09:00 Subject: Re: Example Ruby Code On 08.12.2009 18:30, Christopher Davidson wrote: > Can anybody explain how this code actually works in simple terms if > possible :). > > def animals > yield "Tiger" > yield "Giraffe" > end > > animals { |x| puts "Hello, #{x}" } The code defines a method "animals" which accepts an anonymous callback function (the block). That callback is invoked via "yield" and arguments to "yield" are passed to the block. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/