From: Joao Pedrosa Date: 2005-02-14T09:19:41+09:00 Subject: Re: mandatory braces Hi, On Mon, 14 Feb 2005 09:11:34 +0900, David A. Black wrote: > Hi -- > > On Mon, 14 Feb 2005, Joao Pedrosa wrote: > > > I think that one of the things that make Ruby what it is is the > > general flexibility of its syntax. The other day I saw this in an > > example for Rails: > > > > {= foo.flash['bar'] if foo.flash['bar'] } > > > > or Something... See? The flexibility paid off for the guy that wanted > > to use it like that. > > Isn't the idea there to produce a string value if there is one > returned by foo.flash['bar'], but not otherwise? If so, and unless > there's some weird default thing going on, it could be written with > just one foo.flash['bar'] -- which will return nil if not defined, > which is exactly what the unsuccessful 'if' clause will return, and > that nil (either way) will be represented as an empty string. So > while you can use the 'if', there's no gain from doing so in this > case. > > (Assuming I'm interpreting the intention correctly, of course.) In this case you are right. I probably messed up the example, but with a more complex "if" it could be handy. :-) Thanks for clarifying. Cheers, Joao