aboutsummaryrefslogtreecommitdiff
path: root/examples/example.imp
diff options
context:
space:
mode:
Diffstat (limited to 'examples/example.imp')
-rw-r--r--examples/example.imp21
1 files changed, 10 insertions, 11 deletions
diff --git a/examples/example.imp b/examples/example.imp
index a5bc5dd..de76b27 100644
--- a/examples/example.imp
+++ b/examples/example.imp
@@ -1,12 +1,11 @@
-procedure factorial(n;r) begin
- if n <= 0 then
- r := 1;
- else
- m := n - 1;
- factorial(m;r);
- r := r * n;
- end;
-end;
-
+f1 := 0;
+f2 := 1;
n := 5;
-factorial(n;r); \ No newline at end of file
+
+while n # 0 do
+ var tmp := f2 in
+ f2 := f1 + f2;
+ f1 := tmp;
+ end;
+ n := n - 1;
+end; \ No newline at end of file