I think it's because when that for loop is compiled, it doesn't know for certain that the if statement will be false in the first pass. I think that's something that the compiler *could* know, but it takes a lot of extra processing to prove those cases generically.
On Wednesday, April 29, 2015 at 9:53:23 AM UTC-4, Pooya wrote: > > Can someone explain why this is the desired behavior? z is defined until > the end of first iteration in the for loop, but not in the beginning of the > next: > > julia> for i=1:10 > if i>=2; println(z); end > z=2 > g()=2z > println(z) > end > 2 > ERROR: z not defined > in anonymous at no file:2 >