From: matz@... (Yukihiro Matsumoto) Date: 2002-10-30T15:29:40+09:00 Subject: Re: "multiple assignment in conditional" Hi, In message ""multiple assignment in conditional"" on 02/10/30, "Gavin Sinclair" writes: |Given this: | | def foo | [4,5] | end | |Both of the following expressions give me a SyntaxError: "multiple assignment |in conditional" (this is Ruby 1.6.5 on Cygwin): | | a, b = foo and puts a | (a, b = foo) and puts a | |I must say that I'm perplexed by this. "Ruby in a Nutshell" (p. 18) tells me |that "and" has lower precedence than "=". Of course, the parentheses make my |intention clear anyway, and I still get the error. So I just don't understand. The resulting value of multiple assignment may not be what you expect, due to value-array conversion. % ruby1.6 -e 'p ((a,b = nil))' [nil] % ruby1.7 -e 'p ((a,b = nil))' [] That's why I warned you. matz.