diff options
| author | Paul Buetow <paul@buetow.org> | 2008-10-19 00:12:57 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2008-10-19 00:12:57 +0000 |
| commit | 982e35bd0bd9bc9b55c0f898556c3e1831141258 (patch) | |
| tree | 95d12d94983ac396c693f96825cc3beea8cad50c /tmp | |
| parent | 41e590f05d295a40ba4633d493be1ffe28f16ddf (diff) | |
synonyms work
Diffstat (limited to 'tmp')
| -rw-r--r-- | tmp/test.fy | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/tmp/test.fy b/tmp/test.fy index afe2cec..3ffb105 100644 --- a/tmp/test.fy +++ b/tmp/test.fy @@ -1,3 +1,32 @@ +#* + * Examples of how to use synonyms + *# +# Create a variable foo, and bar is a synonym for foo +my foo = "foo"; +my bar = \foo; + +# Reset the value of foo +foo = "bar"; + +# The synonym variable should now also set to "bar" +assert "bar" == say bar; + +# Create a new procedure baz +proc baz { + say "I am baz"; +} + +# Make a synonym baz, and undefine baz +my bay = \baz; +undef baz; + +# bay still has a reference of the original procedure baz +bay; # this prints aut "I am baz" + +assert 0 == defined baz; +assert 1 == defined bay; + +# This removes the procedure from memory +undef bay; -my foo = [1, 2.2, "3"]; |
