mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 15:48:51 +00:00
"Revert" to older demo
This commit is contained in:
+15
-16
@@ -1,19 +1,18 @@
|
|||||||
import (
|
import "fmt.odin";
|
||||||
"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";
|
|
||||||
)
|
|
||||||
|
|
||||||
proc main() {
|
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);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user