From 0fa2f445eb7140214471074fc544adfd0f8a524f Mon Sep 17 00:00:00 2001 From: Mathias Magnusson Date: Thu, 24 Jul 2025 22:15:03 +0200 Subject: 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 --- fibonacci.hgn | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'fibonacci.hgn') 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) -- cgit v1.2.3