From: Christopher Davidson Date: 2009-12-09T06:03:18+09:00 Subject: Re: Example Ruby Code Marnen Laibow-Koser wrote: > 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}" } > > Go read about blocks in Ruby. If you don't understand something once > you've done that, hopefully you'll have a more specific question to > ask... > > Best, > --  > Marnen Laibow-Koser > http://www.marnen.org > marnen@marnen.org I read about Blocks and thought I understood this quite well, I understand how this is working nearly, the only thing I don't understand is how the |x| can be calling the defined yields earlier? Is |x| a special scenario? -- Posted via http://www.ruby-forum.com/.