Re: Phix loop variables and scope
- Posted by petelomax May 25, 2018
- 1070 views
_tom said...
looks like this "namespace" idea is incomplete.
They do what they were intended for, perfectly well, at least in my book.
[EDIT: Actually, some people do tend to abuse them, and fair point, they don't always withstand mistreatment too well...]
_tom said...
What do you mean by "pre-declaring" ? (I only understand examples.)
pre-declared:
integer x=0 for x=2 to 7 do end for ?x -- valid
not pre-declared:
for y=2 to 7 do end for --?y -- invalid
both (should) work equally, except as shown x can be referenced after the end for but y cannot.