mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 07:08:48 +00:00
Revert to previous demo
This commit is contained in:
+13
-7
@@ -1,12 +1,18 @@
|
|||||||
#import "fmt.odin";
|
#import "fmt.odin";
|
||||||
|
|
||||||
main :: proc() {
|
main :: proc() {
|
||||||
x: atomic int = 123;
|
immutable program := "+ + * - /";
|
||||||
fmt.println(x);
|
accumulator := 0;
|
||||||
arr :[dynamic]any;
|
|
||||||
append(arr, "123", 123, 3.14159265359878, true);
|
for token in program {
|
||||||
for a in arr {
|
match token {
|
||||||
fmt.println(a);
|
case '+': accumulator += 1;
|
||||||
|
case '-': accumulator -= 1;
|
||||||
|
case '*': accumulator *= 2;
|
||||||
|
case '/': accumulator /= 2;
|
||||||
|
default: // Ignore everything else
|
||||||
|
}
|
||||||
}
|
}
|
||||||
fmt.print(arr, "\n");
|
|
||||||
|
fmt.printf("The program \"%s\" calculates the value %d\n", program, accumulator);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user