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