summaryrefslogtreecommitdiff
path: root/examples/scopeing.fy
diff options
context:
space:
mode:
Diffstat (limited to 'examples/scopeing.fy')
-rw-r--r--examples/scopeing.fy31
1 files changed, 31 insertions, 0 deletions
diff --git a/examples/scopeing.fy b/examples/scopeing.fy
new file mode 100644
index 0000000..434f38f
--- /dev/null
+++ b/examples/scopeing.fy
@@ -0,0 +1,31 @@
+#*
+ * Examples of how to use scopeing
+ *#
+
+my foo = 1;
+
+{
+ # Prints out 1
+ assert 1 == (put defined foo);
+
+ {
+ my bar = 2;
+
+ # Prints out 1
+ assert 1 == (put defined bar);
+
+ # Prints out all available symbols at
+ # the current program position.
+ scope;
+ }
+
+ # Prints out 0
+ assert 0 == (put defined bar);
+
+ my baz = 3;
+}
+
+# Prints out 0
+assert 0 == (say defined bar);
+
+