From ff962b636178ae81978fdd2ce653f4c804ef7a39 Mon Sep 17 00:00:00 2001 From: Mid <> Date: Thu, 2 Jan 2025 18:07:55 +0200 Subject: [PATCH] Add fibonacci to funcdefs.nct --- tests/funcdefs.nct | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/tests/funcdefs.nct b/tests/funcdefs.nct index 31facf7..46bba3f 100644 --- a/tests/funcdefs.nct +++ b/tests/funcdefs.nct @@ -1,7 +1,6 @@ -/* Currently return isn't implemented (and no ret instructions are output either) */ -/* Oh and arguments aren't supported yet either */ -/* But functions work :) */ - -foo: u0() { - return 15; +fibonacci: u32(u32 n) -> { + if(n <= 1) { + return n; + } + return fibonacci(n - 1) + fibonacci(n - 2); };