mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-16 07:14:07 +10:00
24 lines
270 B
Plaintext
24 lines
270 B
Plaintext
//create a bunch of toy functions as literals to be called from C
|
|
|
|
fn answer() {
|
|
return 42;
|
|
}
|
|
|
|
fn identity(x) {
|
|
return x;
|
|
}
|
|
|
|
fn makeCounter() {
|
|
var total = 0;
|
|
|
|
fn counter() {
|
|
return ++total;
|
|
}
|
|
|
|
return counter;
|
|
}
|
|
|
|
fn fail() {
|
|
assert false, "Failed correctly";
|
|
}
|