Files
Toy/examples/tally.toy
T
Ratstail91 92e4a41662 Renamed 'scripts' directory to 'examples'
Also allowed assignment within conditionals
2026-05-26 23:42:33 +10:00

22 lines
257 B
Plaintext

fn makeCounter() {
var counter: Int = 0;
fn increment() {
return ++counter;
}
return increment;
}
//'tally' becomes a closure
var tally = makeCounter();
var result = 0;
while (result = tally()) {
print result;
if (result >= 10) {
break;
}
}