From 9bf07e1dfa69b5d6e4c296c0690b5ed91f909b7b Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Tue, 26 Aug 2008 08:17:55 +0000 Subject: added v0.1 branch --- examples/procedures.fy | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 examples/procedures.fy (limited to 'examples/procedures.fy') diff --git a/examples/procedures.fy b/examples/procedures.fy new file mode 100644 index 0000000..cbe2121 --- /dev/null +++ b/examples/procedures.fy @@ -0,0 +1,30 @@ +#* + * Examples of how to use procedures + *# + +proc foo { + say 1 + a * 3 + b; + my c = 6; +} + +my a = 2, b = 4; + +foo; # Run the procedure. Print out "11\n" +say c; # Print out "6\n"; + +proc bar { + say "I am bar"; + + undef baz; + + proc baz { + say "I am baz"; + } +} + +# Here bar would produce an error because the proc is not yet defined! +# bar; + +bar; # Here the procedure bar will define the procedure baz! +baz; # Now the procedure baz is defined! +bar; # Here the procedure bar will redefine baz again! -- cgit v1.2.3