aboutsummaryrefslogtreecommitdiff
path: root/code
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-02-10 14:59:18 +0000
committerGinger Bill <bill@gingerbill.org>2017-02-10 14:59:18 +0000
commitf18ae89931526df578956e63dfab288920b59873 (patch)
tree2cf3bc1afa048b879d974f983c1015580684e084 /code
parent454d0b5cf5b109fda01b3380b1fab0434d7ff51d (diff)
Remove Maybe type; Enum `names`
Diffstat (limited to 'code')
-rw-r--r--code/demo.odin77
1 files changed, 38 insertions, 39 deletions
diff --git a/code/demo.odin b/code/demo.odin
index bc193ef1f..2577f8d3c 100644
--- a/code/demo.odin
+++ b/code/demo.odin
@@ -11,16 +11,27 @@
main :: proc() {
{
+ Fruit :: enum {
+ APPLE,
+ BANANA,
+ COCONUT,
+ }
+
+ fmt.println(Fruit.names);
+ }
+
+when false {
+ {
m: map[f32]int;
- reserve(^m, 16);
+ reserve(m, 16);
defer free(m);
m[1.0] = 1278;
m[2.0] = 7643;
m[3.0] = 564;
- c := m[3.0];
_, ok := m[3.0];
- // assert(ok && c == 564);
+ c := m[3.0];
+ assert(ok && c == 564);
fmt.print("map[");
i := 0;
@@ -28,7 +39,7 @@ main :: proc() {
if i > 0 {
fmt.print(", ");
}
- fmt.printf("%f=%v", key, val);
+ fmt.printf("%v=%v", key, val);
i += 1;
}
fmt.println("]");
@@ -48,48 +59,36 @@ main :: proc() {
fmt.println(m);
}
-
-
- // fm: map[128, int]f32;
-
-/*
{
- sig: u32;
- x := __cpuid(0, ^sig);
- fmt.println(sig, x);
- }
-
-
-
- i: int;
-
- fmt.println("Hellope!");
+ fmt.println("Hellope!");
- x: [dynamic]f64;
- defer free(x);
- append(^x, 2_000_000.500_000, 3, 5, 7);
+ x: [dynamic]f64;
+ reserve(x, 16);
+ defer free(x);
+ append(x, 2_000_000.500_000, 3, 5, 7);
- for p, i in x {
- if i > 0 { fmt.print(", "); }
- fmt.print(p);
- }
- fmt.println();
+ for p, i in x {
+ if i > 0 { fmt.print(", "); }
+ fmt.print(p);
+ }
+ fmt.println();
- {
- Vec3 :: [vector 3]f32;
+ {
+ Vec3 :: [vector 3]f32;
- x := Vec3{1, 2, 3};
- y := Vec3{4, 5, 6};
- fmt.println(x < y);
- fmt.println(x + y);
- fmt.println(x - y);
- fmt.println(x * y);
- fmt.println(x / y);
+ x := Vec3{1, 2, 3};
+ y := Vec3{4, 5, 6};
+ fmt.println(x < y);
+ fmt.println(x + y);
+ fmt.println(x - y);
+ fmt.println(x * y);
+ fmt.println(x / y);
- for i in x {
- fmt.println(i);
+ for i in x {
+ fmt.println(i);
+ }
}
}
-*/
+}
}