[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Newbie question: Small blocks

Jeremy Woertink

9/10/2007 7:52:00 PM

You can type any block with the { } or the do..end way. You don't have
to have the pipes, but without them you don't have a way to pass items
of your collection into the block. So for example

array.each { puts "HELLO" } <--- no pipes, but no data

The only thing I can think of where you would have seen the & would be
something like

irb(main):001:0> (0..5).each { 0 & 5 }
=> 0..5
irb(main):002:0>


~Jeremy
--
Posted via http://www.ruby-....