From ebfd74ddf0ef6372624ea171e06f8460d0e1351b Mon Sep 17 00:00:00 2001 From: Cody Date: Mon, 27 Feb 2023 07:21:50 -0600 Subject: pain --- examples/fib_rec.sloth | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 examples/fib_rec.sloth (limited to 'examples/fib_rec.sloth') diff --git a/examples/fib_rec.sloth b/examples/fib_rec.sloth new file mode 100644 index 0000000..306bcdf --- /dev/null +++ b/examples/fib_rec.sloth @@ -0,0 +1,7 @@ +## Calculate a specific number in the fibonacci sequence +fn fib(n: i32) -> i32 { + match n { + 0 | 1 => n, + _ => fib(n - 1) + fib(n - 2), + } +} -- cgit v1.2.3