From: dblack@... Date: 2002-08-11T10:53:52+09:00 Subject: Re: Style question Hi -- On Sun, 11 Aug 2002, Dossy wrote: > Let me ask a related question: is there a accepted standard > of where the |...| go? > > This is what I have been doing: > > One-liners look like: > > [1, 2, 3].each { |x| p x } > > Multi-liners can look like: > > [1, 2, 3].each { |x| > p x > p x + 1 > } > > or > > [1, 2, 3].each { > |x| > p x > p x + 1 > } > > or > > [1, 2, 3].each do > |x| > p x > p x + 1 > end > > I don't often use "do |x|\n" ... not sure why. That's the one I like for multi-line ones :-) I personally don't like the |x| on a separate line -- it always jolts visually, sort of the visual equivalent of how it sounds when people read poetry and pause at the end of each line whether it needs it or not. I really like the majority of guidelines in: http://www.jin.gr.jp/~nahi/RWiki/?cmd=view;name=RubyCodingConvention David -- David Alan Black home: dblack@candle.superlink.net work: blackdav@shu.edu Web: http://pirate.shu.edu/~blackdav