From: botp Date: 2012-02-02T18:03:28+09:00 Subject: Re: Multiple assignment in conditional On Thu, Feb 2, 2012 at 4:57 PM, botp wrote: > On Thu, Feb 2, 2012 at 3:47 PM, Robert Klemme > wrote: >> On Thu, Feb 2, 2012 at 3:56 AM, botp wrote: >>> indeed. ruby just checks the last assignment. >>> >>>> if (x,y=(a, b = foo)) >>>> p 1 >>>> end >>> SyntaxError: (irb):17: multiple assignment in conditional >>> >>> but i do not know why it has to do that checking. too much work. and >>> could probably slow down ruby. >> >> Probably because (a,b=foo) in all but the latest version always yields >> an Array which is true hence does not make sense as a condition.  You >> could write if (true) as well. > > ah, portability/compatibility. i guess we're stucked then :) > thanks Robert. > best regards -botp ok, i'll take it back, since, if only the latest version makes sense, then wouldn't that mean it's not really being used in the earlier versions, and therefore, it *is* safe to implement it currently, ie remove the checking? kind regards -botp