bcc
bcc copied to clipboard
Globals in For Loops ( or other "blocks" )
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".