Forum: Ruby Re: Indentation vs. "end"s

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
87e9a89c53ccf984db792113471c2171?d=identicon&s=25 Kroeger, Simon (ext) (Guest)
on 2006-02-03 11:34
(Received via mailing list)
>    if (cond) {meth this; func that}  #(2)

how about:

(puts 'this'; puts 'that') if true


52a177e9dbd3e614825aabc4e45f8cd6?d=identicon&s=25 Mark Volkmann (Guest)
on 2006-02-03 15:02
(Received via mailing list)
On 2/3/06, Kroeger, Simon (ext) <> wrote:
> >    if (cond) {meth this; func that}  #(2)
> how about:
> (puts 'this'; puts 'that') if true

I'll chime in and say that I also don't like the ";;" idea.

I've always thought that parens could be used better, so I like
Simon's suggestion. In fact, if I were designing a language from
scratch, I'd use parens differently for method calls.

Instead of

calculate_average(19, sum(4, 7), 3)

I'd make it

calculate_average 19 (sum 4 7) 3

Parens would only be used to group method names with arguments when
there is more than one method call on the same line. Commas aren't
even necessary. Of course this is too drastic of a change to make to
Ruby at this point.
Bc1be28c781b5009bbc1cac528afac92?d=identicon&s=25 unknown (Guest)
on 2006-02-03 21:15
(Received via mailing list)
> >    if (cond) {meth this; func that}  #(2)
> how about:
> (puts 'this'; puts 'that') if true

Thanks for the suggestion.  That may be a good
solution for this particular case.  But, how about

    if condy then pet bush else bash him end #(3)

?  Well, I think our main point is not how we can
come up with a nice looking construct for each case,
but what normal, regular constracts look like.

This topic is locked and can not be replied to.