Phix loop variables and scope
- Posted by lesterb May 25, 2018
- 1133 views
This little program (looptest.exw) came about because of a forum question for another language entirely.
integer x=0 for x=2 to 7 do ?x end for ?x
I believe the program is legal but it will not run. I get this...
<13:47:53>p looptest.exw c:\Users\Dev\phix\looptest.exw:5 ?x ^ a namespace qualifier is required x is defined in: c:\Users\Dev\phix\looptest.exw, c:\Users\Dev\phix\looptest.exw. Press Enter, or d for diagnostics...I realised that I have never (ever) tried to use a loop variable that wasn't auto-declared in RDS-Eu or Phix.
Is the request for a namespace the expected response and, if so, how to resolve it? (Phix 0.7.9 - 32 bit Win)
Disclaimer: Since I haven't tried to use a 'global' loop variable in 12 years of Eu / Phix and I believe such things to be the devil's work (I have Ada development in my background) this doesn't cause me any difficulty at all.