RosettaCodeData/Task/Anonymous-recursion/Julia/anonymous-recursion.jl
2024-10-16 18:07:41 -07:00

7 lines
165 B
Julia

function fib(n)
if n < 0
throw(ArgumentError("negative arguments not allowed"))
end
aux(m) = m < 2 ? one(m) : aux(m-1) + aux(m-2)
aux(n)
end