Hi all. I'm having trouble getting "foreach" loops to work:
Test code:Error message:And as additional information, if in my code example above I delete the curly braces forming the foreach loop block, the error message becomes:
Test code:
Code:
44 override void Tick() {45 array<String> testStrings;4647 testStrings.append("A");48 testStrings.append("B");49 testStrings.append("C");5051 foreach (item : testStrings) {52 console.printf("This string: %s", item);53 }5455 Super.Tick();56 }
Example provided on ZDoom.org wiki:...
LoadActors: Load actor definitions.
Script error, "<file.zs>" line 51:
Unexpected '{'
Expecting ';'
Code:
Array<Actor> things;foreach (mo : things){ if (mo) { // Do something }}
...
LoadActors: Load actor definitions.
Script error, "<file>.zs" line 52:
Unexpected identifier
Expecting ';'
Statistics: Posted by D2JK — Tue Jul 30, 2024 12:53 pm