summaryrefslogtreecommitdiff
path: root/examples/functions.fy
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2008-05-15 23:28:07 +0000
committerPaul Buetow <paul@buetow.org>2008-05-15 23:28:07 +0000
commitbe839900419c7a74c4a46efd279d0ca16b35dc1f (patch)
tree1355c8f238d1c58ffd5cb8803bcc2adf987e79aa /examples/functions.fy
parent33c945e58f86267b0d3bdca4c3421155e11eb0d9 (diff)
Moved stuff into trunk.
Diffstat (limited to 'examples/functions.fy')
-rw-r--r--examples/functions.fy25
1 files changed, 25 insertions, 0 deletions
diff --git a/examples/functions.fy b/examples/functions.fy
new file mode 100644
index 0000000..15856a0
--- /dev/null
+++ b/examples/functions.fy
@@ -0,0 +1,25 @@
+#*
+ * Examples of how to use functions
+ *#
+
+func foo {
+ say 1 + a * 3 + b;
+
+ func bar {
+ say "Hello i am nested";
+ }
+
+ bar; # Calling nested
+}
+
+my a = 2, b = 4; # Create global variables
+foo;
+assert 0 == (defined bar); # bar is not available anymore
+
+func baz {
+ say "I am baz";
+ undef baz;
+}
+
+baz; # Baz deletes itself
+assert 0 == (defined baz); # baz is not available anymore