my code is:
function fib(n::Integer)
if n <= 1
return n
end
return fib(n - 1) + fib(n + 2)
end
for i = 0:40
println(fib(i))
end
and the output is:
0
1
[2] 5540 segmentation fault (core dumped) julia fib.jl
why this?
it’s a fault of my code or of the compiler?
am I doing something wrong?
4 posts - 3 participants