mirror of
https://github.com/odin-lang/Odin.git
synced 2026-04-19 13:00:28 +00:00
Fix ir bugs: global variable names, untyped to any assignment
This commit is contained in:
@@ -14,9 +14,18 @@
|
||||
#import "utf16.odin";
|
||||
|
||||
main :: proc() {
|
||||
if x := 0; x < 0 {
|
||||
fmt.println(x);
|
||||
} else {
|
||||
fmt.println(x);
|
||||
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