By gst
via talklikeaduck.denhaven2.com
Published: Oct 03 2007 / 09:13
Conventional wisdom in Ruby is to use do/end to delimit blocks which contain more than one line of code, and braces for one-line blocks. I've always tended to loosely follow this advice.
Thanks to ruby-talk, I just became aware of Jim Weirich's suggestion to use braces for blocks when the value is being used, and do/end for blocks which are primarily sequences of statements. Jim actually posted this over three years ago, and Joe O'Brien brought it up more recently.
On the whole, I like this idea and will probably adopt it to tune my use of do/end vs. braces.
Add your comment
Voters For This Link (16)
-
gst -
rick -
zis -
daniel -
matt -
bloid -
raganwald -
planetmcd -
mcnaz -
a9bejo -
mutle -
BigFisch -
madlep -
peimei -
davneter -
rifraf


