GLBasic forum

Main forum => Bug Reports => Topic started by: MrTAToad on 2011-Jun-04

Title: FOR/NEXT loop slightly upset by variable name
Post by: MrTAToad on 2011-Jun-04
With this example :

Code (glbasic) Select
LOCAL DISINTEGRATOR%,l%

FOR l%=DISINTEGRATOR% TO DISINTEGRATOR%+1
NEXT


You get :

QuoteC:\Users\Nicholas\AppData\Local\Temp\glbasic\gpc_temp0.cpp: In function `int __GLBASIC__::__MainGameSub_()':
C:\Users\Nicholas\AppData\Local\Temp\glbasic\gpc_temp0.cpp:33: error: `DISINTEGRA' was not declared in this scope
C:\Users\Nicholas\AppData\Local\Temp\glbasic\gpc_temp0.cpp:33: error: `R' was not declared in this scope
C:\Users\Nicholas\AppData\Local\Temp\glbasic\gpc_temp0.cpp:33: error: expected `;' before "TO"
C:\Users\Nicholas\AppData\Local\Temp\glbasic\gpc_temp0.cpp:33: error: `TO' was not declared in this scope
C:\Users\Nicholas\AppData\Local\Temp\glbasic\gpc_temp0.cpp:33: error: expected `)' before "DISINTEGRATOR"
C:\Users\Nicholas\AppData\Local\Temp\glbasic\gpc_temp0.cpp:33: error: expected `;' before ')' token

Because "OR" is used.  However, this is only a problem in loops - without them, the program will work fine...
Title: Re: FOR/NEXT loop slightly upset by variable name
Post by: erico on 2011-Jun-04
I really don“t know, but a variable called DISINTEGRATOR%...
It must be something great! :P
Title: Re: FOR/NEXT loop slightly upset by variable name
Post by: Qedo on 2011-Jun-04
I think the problem is TO and no OR.
Try with NOTO% or RETOMA%
Title: Re: FOR/NEXT loop slightly upset by variable name
Post by: Kitty Hello on 2011-Jun-06
aw, man. Can't we just disallow all-caps variables? :P
Title: Re: FOR/NEXT loop slightly upset by variable name
Post by: MrTAToad on 2011-Jun-06
Oh no - they signify the importance of the variable :)
Title: Re: FOR/NEXT loop slightly upset by variable name
Post by: Kitty Hello on 2011-Jun-06
DISSOLVER% ?  =D

I'll have a look.