Hi --

On Sat, 15 Jul 2006, Robert Dober wrote:

> On 7/7/06, Jeff Pritchard <jp / jeffpritchard.com> wrote:
>> 
>> Everybody else seems to be focusing on your "first, rest" question.  You
>> also asked about general coding style and correctness...
>> 
>> I'm a newbie too, so take this with a grain of salt unless one of the
>> senior members agrees with me.  The thing I found most notable about
>> your code overall was the use of {  } for multi-line blocks.  This is
>> certainly legal, but I think it is considered poor form, as I don't ever
>> see it in ruby code listed here or in books.  As I understand it, the
>> preferred way is to use {} for blocks that are all on one line, and do -
>> end pair for multi-line blocks.
>
>
> Honestly I do not think so, personally I prefer do..end to {..} unless {..}
> looks prettier.
> I too see a tendency to use {} on short blocks but would not go so far to
> say that e.g.
>
> File.open(__FILE__)' {
>   |f|
>   f.each {
>   ...
>   }
> }
>
> is bad or even uncommon practice.

I think putting |f| on its own line is uncommon, and kind of
odd-looking, though it will certainly work.


David

-- 
http://www.rubypowerandlight.com => Ruby/Rails training & consultancy
http://www.manning.com/black     => RUBY FOR RAILS (reviewed on
                                     Slashdot, 7/12/2006!)
http://dablog.rubypal.com        => D[avid ]A[. ]B[lack's][ Web]log
dblack / wobblini.net              => me