aboutsummaryrefslogtreecommitdiff
path: root/example
diff options
context:
space:
mode:
authorFlavian Kaufmann <flavian@flaviankaufmann.ch>2025-05-21 14:05:27 +0200
committerFlavian Kaufmann <flavian@flaviankaufmann.ch>2025-05-21 14:05:27 +0200
commit8b6acc85633520f109d348c5e46c8a89521b3932 (patch)
tree1196ec5c493fd57937e7c84ca6ffb9f2d511b264 /example
parent442eba08dba74c3254a8d089ca1961147e59972b (diff)
downloadimp-8b6acc85633520f109d348c5e46c8a89521b3932.tar.gz
imp-8b6acc85633520f109d348c5e46c8a89521b3932.zip
procedures
Diffstat (limited to 'example')
-rw-r--r--example/example.imp19
1 files changed, 9 insertions, 10 deletions
diff --git a/example/example.imp b/example/example.imp
index b52d2da..a5bc5dd 100644
--- a/example/example.imp
+++ b/example/example.imp
@@ -1,13 +1,12 @@
-y := 0;
-
-var x := 5 in
-
- while x < 10 and true do
- x := (x + 1);
+procedure factorial(n;r) begin
+ if n <= 0 then
+ r := 1;
+ else
+ m := n - 1;
+ factorial(m;r);
+ r := r * n;
end;
-
- y := x;
-
end;
-z := 5; \ No newline at end of file
+n := 5;
+factorial(n;r); \ No newline at end of file