fix for loops

This commit is contained in:
2026-07-11 15:40:48 +10:00
parent 8ef6a4e649
commit da5b3abbff
2 changed files with 7 additions and 7 deletions

View File

@@ -1175,7 +1175,7 @@ ResultType(astNodePtr, ErrorMessage) parseForStatement(CometParser* parser) {
parserNextToken(parser);
bool isArrayLoop = !currentTokenIs(parser, CT_DOT_DOT);
bool isArrayLoop = !peekTokenIs(parser, CT_DOT_DOT);
if (isArrayLoop) { // we're looping over an array
ResultType(astNodePtr, ErrorMessage) array = parseExpression(parser, PRECEDENCE_LOWEST);
if (array.error) {

View File

@@ -1,11 +1,11 @@
import io
func main() -> int {
int[3] array = [1, 2, 3]
for int x in array {
io.println("%n", x)
func main() -> void {
for int v in [1,2,3,4,5] {
io.println("value %n at index %n", v, i)
}
return 0
for int i in 0 .. 10 {
io.println("%n", i)
}
}