From: Kristof Bastiaensen Date: 2004-05-02T19:43:58+09:00 Subject: Re: Ruby Newbie (ooh, that rhymes!) - When do I use do/end, when {}? On Sun, 02 May 2004 09:43:20 +0900, Gennady Bystritsky wrote: > There's also another usage some people, including myself, agree on: > do...end for blocks that actually DO stuff, like in Array#each, > File.open, Integer#times (Mark, sorry for contradiction ;-)), etc.; {} > for blocks that define conditions, like in map, select/reject, sort, > etc. > I also like to use {} when I know the block will still exist after the method finishes (for example in signal callbacks or lambda expressions). This way you can see clearly what belongs together. Anyway calling it a rule I find be a bit to strong, I believe it is anyone's one choice which one he/she prefers to use. Kristof