diff options
-rw-r--r-- | examples/5.src | 13 | ||||
-rw-r--r-- | examples/6.src | 8 |
2 files changed, 17 insertions, 4 deletions
diff --git a/examples/5.src b/examples/5.src index 573ee6a..d9a8dad 100644 --- a/examples/5.src +++ b/examples/5.src @@ -1,8 +1,13 @@ -let print_input = (input) => { - print(input); - return input; +let foo = () => { + let x = 1; + print(x); + return x; }; let main = () => { - return print_input(7); + let x = 2; + /* As you see, the language supports variable scopes */ + foo(); + print(x); + return x; }; diff --git a/examples/6.src b/examples/6.src new file mode 100644 index 0000000..573ee6a --- /dev/null +++ b/examples/6.src @@ -0,0 +1,8 @@ +let print_input = (input) => { + print(input); + return input; +}; + +let main = () => { + return print_input(7); +}; |