Greetings all,

I've quite taken to the short-circuit evaluation idiom. I just have a quick 
question about its behavior. Why does

boolexpr && boolvar = false

throw an error ("syntax: invalid assignment location"), but

boolexpr && (boolvar = false)

work just fine? The documentation 
(http://docs.julialang.org/en/latest/manual/control-flow/#short-circuit-evaluation)
 
doesn't quite mention this point, though the parentheses are used in the 
examples at the end of the section.

I'm just curious. I don't have much background in programming (but will 
have to, as I'm beginning graduate study in statistics this coming fall -- 
I thought I'd be an early adopter of something for once), so please humor 
me if this is a silly question.

Thank you,
D

Reply via email to