FOR/NEXT loop slightly upset by variable name

Previous topic - Next topic

MrTAToad

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...

erico

I really don´t know, but a variable called DISINTEGRATOR%...
It must be something great! :P

Qedo

I think the problem is TO and no OR.
Try with NOTO% or RETOMA%

Kitty Hello

aw, man. Can't we just disallow all-caps variables? :P

MrTAToad

Oh no - they signify the importance of the variable :)

Kitty Hello