Skip to content

Instantly share code, notes, and snippets.

@vasily-kirichenko
Created June 16, 2012 11:58
Show Gist options
  • Save vasily-kirichenko/2941159 to your computer and use it in GitHub Desktop.
Save vasily-kirichenko/2941159 to your computer and use it in GitHub Desktop.
Fibonacci in Erlang
fib(0) -> 0;
fib(1) -> 1;
fib(N) when N > 0 -> fib(N - 1) + fib(N - 2).
lists:foreach(fun(N) -> io:format("n=~p => ~p~n", [N, fib(N)]) end, lists:seq(0, 39)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment