From: gunnar.andersson@... Date: 2002-07-31T23:38:22+09:00 Subject: RE: Style question > --- Jim Freeze wrote: > > On Tue, Jul 30, 2002 at 11:19:52PM +0900, Michael Campbell wrote: > > > Is there an accepted standard as to when to use {} vs do/end? > > > > > I personally like the {} for the simple reason that it is easy > > to test for matching pairs in vi. > > This has been my thought as well. Too, coming from a c/C++/Java > lineage, it "reads" better to me but that's a function of my context, > not the language necessarily. Style issues like this define the feel of a language, but is often dictated, like you suggest, by people's editor support. I'd rather adjust the editor (VIM user) to the style than the opposite, but I also never feel it's a problem to match blocks when the editor indents properly, and when writing in a style that avoids too deep nesting. IMHO do/end is more ruby-like simply because it is more or less unique to ruby. I like that it sets the code apart from the look of other languages. I can immediately recognize it. For touch typists it should be quicker and less strenuous to type several characters than to reach for the shift key but that all depends on your typing and editor support. Long ago I heard many advocating do/end in the general case and {} only for one-liners. It is a style rule I like quite well. /Gunnar