Skip to main content

rl_lang/interpreter/stdlib/math/
fibonacci.rs

1use crate::interpreter::evaluator::Evaluator;
2
3pub fn std_fibonacci(_: &mut Evaluator, x: i64) -> i64 {
4    let (mut a, mut b) = (0, 1);
5    for _ in 0..x {
6        (a, b) = (b, a + b);
7    }
8    a
9}