Files
Toy/scripts/funky.toy
Kayne Ruse 639250f028 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
2025-02-17 19:10:24 +11:00

41 lines
507 B
Plaintext

/*
fn name(param1: int, param2: float, param3: string, param4) {
print param1;
print param2;
print param3;
print param4;
}
name(42, 3.14, "hello world", -1);
fn output(arg) {
print arg;
}
output(null);
output(true);
output(42);
output(3.1415);
output("woot!");
output([1, 23, 3]);
output(["key":1]);
output(name);
*/
fn makeCounter() {
var counter: int = 0;
fn increment() {
return counter++;
}
return increment;
}
var tally = makeCounter();
print tally();
print tally();
print tally();