Given code does not work for me .... IDL does not compile it.
Also, I'm not sure why you are using procedure 'exit'; this will just make IDL save and exit.
Back to your case ....
The proper way to do for loop:
for i=1,2 do begin
print,i
endfor
end
this will give you
1
2
The wrong way to do foor loop
for i=1,2 do begin
end
print,i
end
will give you 3, because the FOR loop iterator (i) is in this case a global variable that made it to 3, loop exited and the value printed is therefor 3
I hope this helps a bit
|