From: Robert Dober Date: 2007-04-13T17:57:47+09:00 Subject: Re: Idiom wanted (now hiring!) On 4/13/07, Joel VanderWerf wrote: > Jonathan wrote: > > Is there a cool way to do this without calling the function twice?: > > > > a = func(b) unless func(b).nil? (AKA) these two are not equivalent, just imagine func(b) returning false > > a = func(b) if func(b) > > a = func(b) || a and if a did not exist before? Well it still works, as I expected given the poster of the message, but I really feel this is not consistent behavior @a = f(b) || @a of course that nicely corresponds to the auto nilification of undefined instance vars, like it or hate it. But for local variables? Cheers Robert > > -- > vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407 > > -- You see things; and you say Why? But I dream things that never were; and I say Why not? -- George Bernard Shaw