Fix ir bugs: global variable names, untyped to any assignment
This commit is contained in:
1 parent
3e80411d37
commit
c067a1f0ec
6 files changed
+52
-25
No files matched your search
+13
-4
@@ -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