aboutsummaryrefslogtreecommitdiff
path: root/code
diff options
context:
space:
mode:
authorGinger Bill <bill@gingerbill.org>2017-05-09 10:01:50 +0100
committerGinger Bill <bill@gingerbill.org>2017-05-09 10:01:50 +0100
commit5595daf5a39306179bb924f0c778bbba284391ec (patch)
treec37150e4b77c5416b53e6df38e809bcd1d187bb5 /code
parent64b5afd82096f3e9dfde125a8846d606db7c85fb (diff)
Revert demo.odin
Diffstat (limited to 'code')
-rw-r--r--code/demo.odin17
1 files changed, 16 insertions, 1 deletions
diff --git a/code/demo.odin b/code/demo.odin
index 660594bae..323754a23 100644
--- a/code/demo.odin
+++ b/code/demo.odin
@@ -1,3 +1,18 @@
+#import "fmt.odin";
+
main :: proc() {
- /*
+ immutable program := "+ + * - /";
+ accumulator := 0;
+
+ for token in program {
+ match token {
+ case '+': accumulator += 1;
+ case '-': accumulator -= 1;
+ case '*': accumulator *= 2;
+ case '/': accumulator /= 2;
+ default: // Ignore everything else
+ }
+ }
+
+ fmt.printf("The program \"%s\" calculates the value %d\n", program, accumulator);
}