From: Logan Capaldo Date: 2005-05-12T08:30:50+09:00 Subject: Re: alternatives to ? : contruct 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 :-) > > David > > -- > David A. Black > dblack@wobblini.net > > 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