Christer Nilsson wrote:
>
> Maybe it has to do with parallell assignment, as the comma is used
> there.
>

I don't think it's that.

>
> My workaround will be to use "&&"
>

Parens will work around either.


&&, ||  "give" you parenthesised left and right terms -
and, or  don't.

     a && b  equates with:  (a and b)

         r = true  and  false
equates with:
       ((r = true) and  false)

Test:
  r2 = ((r = true) and  false)

  p [r, r2]     #=> [true, false]


The following won't make anything clearer but it
may help you to understand why it's not clear ;)

r =   true   and  false   ; p r  #=> true
r =   true   and (false)  ; p r  #=> true
r =  (true ) and  false   ; p r  #=> true
r =   true   &&   false   ; p r  #=> false
r = ( true   and  false ) ; p r  #=> false
r = ( true   and (false)) ; p r  #=> false
r = ((true ) and  false ) ; p r  #=> false
puts
r =   false  or   true    ; p r  #=> false
r =   false  or  (true )  ; p r  #=> false
r =  (false) or   true    ; p r  #=> false
r =   false  ||   true    ; p r  #=> true
r = ( false  or   true  ) ; p r  #=> true
r = ( false  or  (true )) ; p r  #=> true
r = ((false) or   true  ) ; p r  #=> true


daz