Sebastian Hungerecker wrote: > 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 Dear friends, Thanks all of guys especially for sebastian for his deep explanation. by vellingiri. -- Posted via http://www.ruby-forum.com/.