bscotch / stitch

Tools and apps for GameMaker development: a CLI for pipeline development, a VSCode extension for coding, and more.
Other
111 stars 13 forks source link

undeclared variable in for loops #246

Closed kxjjuneau closed 2 months ago

kxjjuneau commented 2 months ago

for(i = 0; i < listSize; i++)

this line says i is undeclared at i < listSize which seems wrong if gml allows me to use i in the loop itself

changing to this removes the error msg so its not that big of a deal just thought id document it since the first way I did it is technically allowed for(var i = 0; i < listSize; i++)

adam-coster commented 2 months ago

Stitch is a little less loose than GameMaker. Technically the explicit var is the correct choice -- without it the i will be expected to either be an instance variable or a global, so it's easy to get into trouble even if GameMaker technically allows it.

Closing as intended.