Golang style enumerations with iota

This commit is contained in:
Ginger Bill
2016-12-19 13:18:20 +00:00
parent f5eeecaca5
commit ac1566762b
6 changed files with 151 additions and 97 deletions

View File

@@ -8,6 +8,29 @@
#import "sync.odin";
#import "utf8.odin";
type float32 f32;
const (
X = iota;
Y;
Z;
A = iota+1;
B;
C;
);
type Byte_Size f64;
const (
_ = iota; // ignore first value by assigning to blank identifier
KB Byte_Size = 1 << (10 * iota);
MB;
GB;
TB;
PB;
EB;
);
proc main() {
fmt.println("Here");
fmt.println(X, Y, Z);
fmt.println(A, B, C);
fmt.println(KB, MB, GB, TB, PB, EB);
}