Le vendredi 30 mai 2014 à 21:08 -0700, Ethan Anderes a écrit : > After reading about it here in GoogleGroups I’ve started using A && B > in place of if A B end and A || B for if !A B end. I love it. However, > I wish the following would work > > > true && d,v = svd(rand(2,2)) false || d,v = svd(rand(2,2)) > > Instead I get ERROR: syntax: invalid assignment locationn The only > thing that works is: > > > true && ((d,v) = svd(rand(2,2))) false || ((d,v) = svd(rand(2,2))) > > Is this a bug or is there an ambiguity I’m not seeing.
I think this is because && has a higher precedence than =. See http://docs.julialang.org/en/latest/manual/mathematical-operations/#operator-precedence There's a discussion about adding and and or to replace && and ||, and these operators would have a lower precedence: https://github.com/JuliaLang/julia/issues/5238 Regards
