Browse Source

"Revert" to older demo

Ginger Bill 8 years ago
parent
commit
76b0c7b765
1 changed files with 15 additions and 16 deletions
  1. 15 16
      code/demo.odin

+ 15 - 16
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);
 }