mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Fixed some indexing bugs
This commit is contained in:
@@ -2,14 +2,24 @@
|
||||
|
||||
|
||||
|
||||
var t: type = astype [int];
|
||||
var u: type = astype [t];
|
||||
fn makeCounter() {
|
||||
var total: int = 0;
|
||||
|
||||
var a: u;
|
||||
fn counter(): int {
|
||||
return ++total;
|
||||
}
|
||||
|
||||
t = astype [float]; //redefnition
|
||||
return counter;
|
||||
}
|
||||
|
||||
var b: u;
|
||||
var tally = makeCounter();
|
||||
|
||||
print typeof a; //<[<int>]>
|
||||
print typeof b; //<[<float>]>
|
||||
print tally(); //1
|
||||
print tally(); //2
|
||||
print tally(); //3
|
||||
|
||||
export tally;
|
||||
|
||||
//heck yeah!
|
||||
import tally as tally2;
|
||||
print tally2(); //4
|
||||
|
||||
Reference in New Issue
Block a user