I had a nasty bug entirely of my own causing, I was using the same loop variable in a nested loop. However the compiler did not complain about this and in pretty much all languages it would.
Here is a simple code fragment that should cause the compiler to complain, in fact the inner variable is in the same scope as the outer one as you can see from the output shown below the code:
for (var i = 0; i < 10; i++)
for (var i = 20; i < 40; i++)
show_debug_message("inner: " + string(i));
show_debug_message("outer: " + string(i));
Which produces this output:
Please sign in to leave a comment.