WIP return keyword, read more

Functions are having issues with being copied around, especially
between buckets, leading to the scopes getting looped. The program gets
stuck in 'incrementRefCount()'.

It's past my time limit, so I'll keep working on it tomorrow with a
fresh mind.

All function stuff is still untested.

See #163
This commit is contained in:
2025-02-17 19:07:14 +11:00
parent 02dfc996b4
commit 639250f028
12 changed files with 215 additions and 26 deletions

View File

@@ -1,3 +1,5 @@
/*
fn name(param1: int, param2: float, param3: string, param4) {
print param1;
print param2;
@@ -7,8 +9,6 @@ fn name(param1: int, param2: float, param3: string, param4) {
name(42, 3.14, "hello world", -1);
//URGENT: return values are still needed
fn output(arg) {
print arg;
}
@@ -20,4 +20,22 @@ output(3.1415);
output("woot!");
output([1, 23, 3]);
output(["key":1]);
output(name);
output(name);
*/
fn makeCounter() {
var counter: int = 0;
fn increment() {
return counter++;
}
return increment;
}
var tally = makeCounter();
print tally();
print tally();
print tally();