From: "David A. Black" Date: 2005-05-12T09:04:15+09:00 Subject: Re: alternatives to ? : contruct Hi -- On Thu, 12 May 2005, Logan Capaldo wrote: > On 5/11/05, David A. Black wrote: >> Hi -- >> >> On Thu, 12 May 2005, Logan Capaldo wrote: >> >>> On 5/11/05, John-Mason P. Shackelford wrote: >>>> As an alternative to: >>>> >>>> a = y == z ? b : c >>>> >>>> we can say: >>>> >>>> a = (b if y == x) || c >>>> >>>> Can anyone think of others? >>> >>> Heres one way: >>> >>> x == y and a = b or c >> >> In the case where x != y, that expression will just return c, without >> assigning it to a. (I learned this the hard way either here or on IRC >> recently :-) > > Yeah, that was the the point. > > If (x == y) then a = b else c end > is equivalent to x == y and a = b or c But it's not equivalent to a = y == z ? b : c David -- David A. Black dblack@wobblini.net