Why does this not compile?
BlitzMax Forums/BlitzMax Programming/Why does this not compile?
| ||
Global a For Local a = 0 To 9 Print a Next If Local is allowed in this case, shouldn't the 'a' be localized to this scope only (and not interfere with the global 'a')? Just wondering. Russell |
| ||
How can it not interfere with a variable which can be read from and written to absolutely anywhere? |
| ||
My guess is that Global A and Local A are both inside the Same section of Code. Hence duplicate Identifier. Locals are meant to be used like Global A:Int Type TFirst Field A:Int Method Update() For Local A:Int = 0 To 9 Print a Next End Method End Type |
| ||
If Local is allowed in this case, shouldn't the 'a' be localized to this scope only (and not interfere with the global 'a')? Only in Strict mode where variables are scoped. Like so:Strict Global a = 100 For Local a = 0 To 9 Print a Next Print a |