bcc icon indicating copy to clipboard operation
bcc copied to clipboard

Globals in For Loops ( or other "blocks" )

Open GWRon opened this issue 1 year ago • 3 comments

a user had an issue reported in discord. I extracted the original problem:

SuperStrict

Type TPlayer
    Field x:Int
End Type

Local list:TList = New TList()

For local o:object = EachIn list
    Global example1:TPlayer = New TPlayer
Next
print example1.x

I thought a global can be declared everywhere - but it seems it can't: Output:

Compile Error: Identifier 'example1' not found.

Same also for While-loops and surely other "blocks". And also inside "if endif".

GWRon avatar Jul 13 '23 10:07 GWRon