aboutsummaryrefslogtreecommitdiff
path: root/test/data/nested-fns.yx
diff options
context:
space:
mode:
Diffstat (limited to 'test/data/nested-fns.yx')
-rw-r--r--test/data/nested-fns.yx13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/data/nested-fns.yx b/test/data/nested-fns.yx
new file mode 100644
index 0000000..3f60f5b
--- /dev/null
+++ b/test/data/nested-fns.yx
@@ -0,0 +1,13 @@
+fn1 :: () int {
+ /* You can create and use nested functions */
+ fn2 :: () int {
+ return fn1() * fn1();
+
+ /* Nested functions shadow parent functions */
+ fn1 :: () int {
+ return 42;
+ }
+ }
+
+ return fn2();
+}