aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2018-08-14 19:29:31 +0100
committergingerBill <bill@gingerbill.org>2018-08-14 19:29:31 +0100
commite1e4a916a5ffb81b4a9fbe6a2ca146db17c42bc8 (patch)
treeb4a89afda20547b51dfb3160dd45b5a18d24a3a8 /examples
parent71f94bff76b419b8382ee6f622121e43124427a8 (diff)
Fix demo and improve type hinting
Diffstat (limited to 'examples')
-rw-r--r--examples/demo/demo.odin76
1 files changed, 24 insertions, 52 deletions
diff --git a/examples/demo/demo.odin b/examples/demo/demo.odin
index ce996cd42..acedd253b 100644
--- a/examples/demo/demo.odin
+++ b/examples/demo/demo.odin
@@ -713,58 +713,30 @@ deprecated_attribute :: proc() {
}
bit_set_type :: proc() {
- {
- using Day :: enum {
- Sunday,
- Monday,
- Tuesday,
- Wednesday,
- Thursday,
- Friday,
- Saturday,
- }
-
- Days :: distinct bit_set[Day];
- WEEKEND :: Days{Sunday, Saturday};
-
- d: Days;
- d = Days{Sunday} | Days{Monday};
- x := Tuesday;
- e := d | WEEKEND;
- e |= {Monday};
- fmt.println(d, e);
-
- ok := Saturday in e; // `in` is only allowed for `map` and `bit_set` types
- fmt.println(ok);
- if Saturday in e {
- fmt.println("Saturday in", e);
- }
- }
- {
- using Days :: bit_set {
- Sunday,
- Monday,
- Tuesday,
- Wednesday,
- Thursday,
- Friday,
- Saturday,
- }
-
- WEEKEND :: Days{Sunday, Saturday};
-
- d: Days;
- d = Days{Sunday} | Days{Monday};
- x := Tuesday;
- e := d | WEEKEND;
- e |= {Monday};
- fmt.println(d, e);
-
- ok := Saturday in e; // `in` is only allowed for `map` and `bit_set` types
- fmt.println(ok);
- if Saturday in e {
- fmt.println("Saturday in", e);
- }
+ using Day :: enum {
+ Sunday,
+ Monday,
+ Tuesday,
+ Wednesday,
+ Thursday,
+ Friday,
+ Saturday,
+ }
+
+ Days :: distinct bit_set[Day];
+ WEEKEND :: Days{Sunday, Saturday};
+
+ d: Days;
+ d = Days{Sunday} | Days{Monday};
+ x := Tuesday;
+ e := d | WEEKEND;
+ e |= {Monday};
+ fmt.println(d, e);
+
+ ok := Saturday in e; // `in` is only allowed for `map` and `bit_set` types
+ fmt.println(ok);
+ if Saturday in e {
+ fmt.println("Saturday in", e);
}
}