aboutsummaryrefslogtreecommitdiff
path: root/fibonacci.hgn
diff options
context:
space:
mode:
authorMathias Magnusson <mathias@magnusson.space>2025-07-24 22:15:03 +0200
committerMathias Magnusson <mathias@magnusson.space>2025-07-24 22:17:19 +0200
commit0fa2f445eb7140214471074fc544adfd0f8a524f (patch)
treecb3bca4a9604df71cfe0cfcdb0c0f1e3590923ea /fibonacci.hgn
parentb3909efb3a6bf76870b686b5062f9a4282fbdd66 (diff)
downloadhuginn-0fa2f445eb7140214471074fc544adfd0f8a524f.tar.gz
continue implementing procedure calls
multiple procedures can now exist, but you cannot call them, the first one is the "main" procedure since it happens to be placed first in the binary, and all procedures end with an exit system call
Diffstat (limited to 'fibonacci.hgn')
-rw-r--r--fibonacci.hgn22
1 files changed, 12 insertions, 10 deletions
diff --git a/fibonacci.hgn b/fibonacci.hgn
index 01d9333..c42241b 100644
--- a/fibonacci.hgn
+++ b/fibonacci.hgn
@@ -1,11 +1,13 @@
-a := 0
-b := 1
-n := 10
-# n := read_int(0)
-while n > 0 {
- c := a + b
- a = b
- b = c
- n = n - 1
+main := proc() {
+ a := 0
+ b := 1
+ n := 10
+ # n := read_int(0)
+ while n > 0 {
+ c := a + b
+ a = b
+ b = c
+ n = n - 1
+ }
+ print(a)
}
-print(a)