aboutsummaryrefslogtreecommitdiff
path: root/code
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-01-01 16:58:38 +0000
committerGinger Bill <bill@gingerbill.org>2017-01-01 16:58:38 +0000
commit311b5cb6e211aa49d8dc0e081173204d7271964f (patch)
tree34e46ebf224736b737f72b2873d5afcaab8d5f17 /code
parent6fef74317cdd0e403fb913ebe965dc08b3dfb22d (diff)
Add enum type info and fix enum casting
Diffstat (limited to 'code')
-rw-r--r--code/demo.odin7
1 files changed, 5 insertions, 2 deletions
diff --git a/code/demo.odin b/code/demo.odin
index bd4ab5dcd..1106b1295 100644
--- a/code/demo.odin
+++ b/code/demo.odin
@@ -11,13 +11,14 @@ import {
win32 "sys/windows.odin";
}
+
type Thing enum f64 {
_, // Ignore first value
A = 1<<(10*iota),
B,
C,
D,
-}
+};
proc main() {
var ti = type_info(Thing);
@@ -32,6 +33,8 @@ proc main() {
fmt.println();
}
- fmt.println(Thing.A, Thing.B, Thing.C, Thing.D);
+ var x Thing = Thing.A;
+
+ fmt.println(x, Thing.B, Thing.C, Thing.D);
}