mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
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
41 lines
507 B
Plaintext
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(); |