From: Henry Maddocks Date: 2013-01-07T10:23:14+09:00 Subject: Re: Best practice for &&, ||, and, or --Boundary_(ID_CSNaNM//LrGN/2zWHgsdUg) Content-type: text/plain; CHARSET=US-ASCII Content-transfer-encoding: 7BIT On 6/01/2013, at 5:56 PM, Jan E. wrote: > Sorry, but if you use assignments in "if" statements (much too obscure) > without explicit parenthesis (even worse), then I'd say *this* is your > problem, not the implicit operator precedence you somehow consider to be > "wrong". Couldn't disagree with you MORE. Assigning the result of an expression is very Rubyish. Assigning the result of an if statement is an elegant way of eliminating redundant assignments. x = if y && z 1 else 2 end vs x = 0 if y && z x = 1 else x = 2 end I agree that "and" / "or" are used for flow control NOT logical expressions. Henry --Boundary_(ID_CSNaNM//LrGN/2zWHgsdUg) Content-type: text/html; CHARSET=US-ASCII Content-transfer-encoding: quoted-printable lists@ruby-forum.com> = wrote:
 
 
 

x =3D if y && z
  1
else
  = 2
end

vs

x =3D = 0

if y && z
  x =3D 1
else
  x =3D = 2
end

I agree that "and" / "or" =  are used for flow control NOT logical = expressions.

Henry


<= /div>= --Boundary_(ID_CSNaNM//LrGN/2zWHgsdUg)--