From: James Britt Date: 2004-05-02T08:53:40+09:00 Subject: Re: {} VS do/end styles Jim Weirich wrote: > Mark Hubbart wrote: > >> While there is some amount of preference involved, there is a general >> rule that most Ruby programmers (and matz, I believe) agree on: >> brackets for one-line blocks, do...end for longer blocks. ie: > > > I've heard that general advice, and even followed it for a while. I > finally gave up on it because many one liners grow into multiline > blocks, and it was just annoying to switch from {} to do/end when that > happened. Plus the style choice wasn't conveying any additional > information, so I dropped it and went back to a "whatever looks good" > style. > > Just recently I've been trying out the following guidelines: > > o If the block returns a value, use {} > o if the block doesn't return a value, use do/end { ... } means less typing, plus brace matching in Vim. Yeah, I know that the ruby plugin for Vim will auto-type do/end for me, but I also find the braces visually cleaner. James