Thanks Glen, terrific work!

However, at the risk of being accused of bad coding practices, what is the problem with declaring a global variable as a local variable?

eg.

Code:
Global $i ;Global counter for something


Function SomeFunc($par1)


Dim $i ;internal to the function and doesn't change the global $i
For $i = 0 to $par1
;do something
Next

EndFunction