diff options
| author | Paul Buetow <paul@buetow.org> | 2008-08-26 08:17:55 +0000 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2008-08-26 08:17:55 +0000 |
| commit | 9bf07e1dfa69b5d6e4c296c0690b5ed91f909b7b (patch) | |
| tree | 60f46be65a1fbaeed2f5deb1d4dbcf5ea68e0d01 /examples/control.fy | |
added v0.1 branch
Diffstat (limited to 'examples/control.fy')
| -rw-r--r-- | examples/control.fy | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/examples/control.fy b/examples/control.fy new file mode 100644 index 0000000..0deac78 --- /dev/null +++ b/examples/control.fy @@ -0,0 +1,32 @@ +#* + * Examples of how to use control statements + *# + +if 1 { + say "if 1"; +} + +ifnot 0 == 1 { + say "ifnot 0 == 1"; +} + +# Calculate 10! + +my n = 10, fac = 0; + +while n > 1 { + ifnot fac { + fac = 1; + } + say fac = (fac * n); + decr n; +} + +# Count up to 10 + +n = 0; + +until n == 10 { + say incr n; +} + |
