Im confused on While
-
If I have some code that says:
Loop While layout == "game" loop //stuff Repeat Repeat
It says that the variable Layout doesn't exist, and points me to the second function in the while loop. However if I do:
Loop If layout == "game" then //stuff Repeat Repeat
It works fine, no errors. I should note, none of the functions in those while/if statements reference the layout variable, nor do they reference anything that references the layout variable.
No clue why I get this error -
This works fine for me:
layout = "game" loop while layout == "game" loop print("stuff") update() repeat repeat
but if you remove the first line, and this is your whole program, then it does not work:
loop while layout == "game" loop print("stuff") update() repeat repeat
However if you've never assigned a value to "layout" or declared it, then it won't work with an if statement either.
So this will give the same error:loop if layout == "game" then print("stuff") update() endif repeat
So without more context on where you assign a value to
layout
or where you declare it, to me it doesn't seem to be related towhile
? -
@PB____ sorry, I should clarify that I declare layout before the game loop with my other variables
-
If I declare the variable without assigning it, I do get an error, both when using
if
and when usingwhile
, so it doesn't appear to discriminate there.And if I do assign it a value before hand, I don't get the error.
It is a known issue though that if an error occurs, Fuze might point to the wrong line in your code. Maybe something like that is going on? Are you sure the issue is really with the difference between
loop
andwhile
? -
@PB____ yes. The only thing that changed was instead of using while I used if then. In both scenarios Layout = "Game" before the loop
-
Weird. I must be doing something differently, because for me it works normally for both
if layout == "game" then
andwhile layout == "game" loop