aboutsummaryrefslogtreecommitdiff
path: root/examples/fib_rec.sloth
blob: 306bcdf56c04f540f9cca945a8ce4b26e4dfab34 (plain)
1
2
3
4
5
6
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),
    }
}