-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: make global variables behave like local variables
- Loading branch information
1 parent
ec4523a
commit 857749e
Showing
7 changed files
with
45 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using io | ||
using strings | ||
|
||
var global int | ||
|
||
fn main () | ||
var local int | ||
|
||
"Save values to local and global memory and print them" println | ||
"Also, using them in arithmetics" println | ||
"Global is 13, local is 17" println | ||
13 &global ! | ||
17 &local ! | ||
|
||
"Global: " print global println | ||
"Local: " print local println | ||
|
||
"Result should be 30" println | ||
"Result: " print global local + println | ||
ret |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,7 @@ | ||
Save the number to static memory and print it | ||
The number is 1234567890123 1234567890123 | ||
Save values to local and global memory and print them | ||
Also, using them in arithmetics | ||
Global is 13, local is 17 | ||
Global: 13 | ||
Local: 17 | ||
Result should be 30 | ||
Result: 30 |