mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
26 lines
266 B
Plaintext
26 lines
266 B
Plaintext
|
|
|
|
|
|
|
|
fn makeCounter() {
|
|
var total: int = 0;
|
|
|
|
fn counter(): int {
|
|
return ++total;
|
|
}
|
|
|
|
return counter;
|
|
}
|
|
|
|
var tally = makeCounter();
|
|
|
|
print tally(); //1
|
|
print tally(); //2
|
|
print tally(); //3
|
|
|
|
export tally;
|
|
|
|
//heck yeah!
|
|
import tally as tally2;
|
|
print tally2(); //4
|