run the test code in its own project?
you're using it inside your larger project where you may have already declared Failed or some other code is conflicting somewhere?
the Unexpected Token is probably referring to your use of GetStringToken() or GetStringToken2() somewhere, so...
i dont know what gets compiled when but i'm pretty sure it's not in the exact order that we enter the code? in other words, just because that test code is near the top of your code, it doesn't mean "later" code doesn't make it to the compiler first. someone please feel free to correct me here
add, this compiles/runs fine for me:
Failed as String : Failed = "Failed String"
Type Result
Failed, Succeeded
EndType
Results as Result
do
If GetRawKeyState(27) then End
If Last# + 0.25 <= Timer()
If Random(1,2) = 1 then INC Results.Failed else INC Results.Succeeded
Last# = Timer()
EndIf
Print(Results.Failed)
Print(Results.Succeeded)
Print(Failed)
Sync()
loop
which version of Classic are you running. this is now ringing a bell from a couple of years ago. i'll start searching...
THIS is what i was referring to and doesn't seem related but reading
raven's response in the thread may provide some insight (i don't have time to get through it all ATM).
meanwhile, i've added #option_explicit:
SetErrorMode(2)
#option_explicit
// set window properties
SetWindowTitle( "Failed" )
SetWindowSize( 1280,720, 0 )
// set display properties
SetVirtualResolution( 1280,720)
SetOrientationAllowed( 1, 1, 1, 1 )
SetSyncRate( 30, 0 )
SetScissor( 0,0,0,0 )
UseNewDefaultFonts( 1 )
Failed as String : Failed = "Failed String"
Last# as Float
Type Result
Failed, Succeeded
EndType
Results as Result
do
If GetRawKeyState(27) then End
If Last# + 0.25 <= Timer()
If Random(1,2) = 1 then INC Results.Failed else INC Results.Succeeded
Last# = Timer()
EndIf
Print(Results.Failed)
Print(Results.Succeeded)
Print(Failed)
Sync()
loop
...and i still have no issues where i expected:
Type Result
Failed, Succeeded
EndType
to "error: "Failed" has not been defined" along with "Succeeded" but didn't.