Fixed invoking functions within function arguments

Somewhat similar to c9d4b9965c
This commit is contained in:
2026-05-19 13:21:41 +10:00
parent a0d75b3c70
commit f55f27726c
10 changed files with 115 additions and 47 deletions
+31
View File
@@ -0,0 +1,31 @@
//WARN: This is just a scratch pad, don't use it
//for (var i in array) print i;
//for (var i in range(10)) print i;
//example of a `range` function
fn range(limit: Int) {
var counter: Int = 0;
fn next() {
if (counter >= limit) {
return null;
}
else return counter++;
}
return next;
}
var next = range(10);
fn log(x) {
if (x == null) return;
print x;
}
while (true) {
log(next());
}