From: Sebastian Hungerecker Date: 2007-10-30T18:41:06+09:00 Subject: Re: what is the difference between two block? Arul hari wrote: > Sebastian Hungerecker wrote: > > it's convention to use > > {} for single-line blocks and do end for multi-line blocks. > > How do you say single line blocks and multi-line blocks. Ehrm, I open my mouth and the words come out? I don't quite understand your question. > We can use both the methods are multi-line blocks. You can use {} as well as do end for multi-line blocks, yes (I'm assuming that's what you meant to convey with the above sentence, although honstly I had some trouble parsing that). But it's *convention* to use do end for multi-line blocks. It's only convention, it's not enforced by ruby. As I said: the only real difference is precedence. > could you say some example. 10.times {|i| bar=something(i) foo=bar.some_thing_else puts foo } # Discouraged 10.times do |i| bar=something(i) foo=bar.some_thing_else puts foo end # Encouraged HTH, Sebastian -- Jabber: sepp2k@jabber.org ICQ: 205544826