Use locals. Use locals. USE LOCALS.
Ignoring that vex says they are faster, and that "bj_forLoopAIndex" will make your code stretch off the screen: global iterators would cause you incredible pain.
If you use global iterators, calling a custom function may change your iterator. That means you need to remember every iterator every function uses. If you forget one, and call that function from a loop using the wrong iterator, your loop will behave erratically and it will take at least 10 minutes to find the problem; IF YOU EVEN NOTICE IT. I can not emphasize enough how bad this is once your map starts getting complex.
There is a reason global variables get a lot of hate. |