aboutsummaryrefslogtreecommitdiff
path: root/code
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-06-12 21:27:53 +0100
committerGinger Bill <bill@gingerbill.org>2017-06-12 21:27:53 +0100
commit76b0c7b7650449349eef17b33fee8515136871c6 (patch)
tree2562b4add35f2b55cbcf25eb1f8b1d70a5f74526 /code
parent91857e8f16fc5328daa175aa3059bafe7c989ccc (diff)
"Revert" to older demo
Diffstat (limited to 'code')
-rw-r--r--code/demo.odin31
1 files changed, 15 insertions, 16 deletions
diff --git a/code/demo.odin b/code/demo.odin
index e72beb77f..0db3e0b55 100644
--- a/code/demo.odin
+++ b/code/demo.odin
@@ -1,19 +1,18 @@
-import (
- "fmt.odin";
- "hash.odin";
- "atomics.odin";
- "bits.odin";
- "math.odin";
- "mem.odin";
- "opengl.odin";
- "strconv.odin";
- "strings.odin";
- "sync.odin";
- "types.odin";
- "utf8.odin";
- "utf16.odin";
-)
+import "fmt.odin";
proc main() {
- fmt.println("Hellope!");
+ let program = "+ + * - /";
+ var accumulator = 0;
+
+ for token in program {
+ match token {
+ case '+': accumulator += 1;
+ case '-': accumulator -= 1;
+ case '*': accumulator *= 2;
+ case '/': accumulator /= 2;
+ case: // Ignore everything else
+ }
+ }
+
+ fmt.printf("The program \"%s\" calculates the value %d\n", program, accumulator);
}