Commits

Anonymous committed e210294

erlang fibonacci

  • Participants
  • Parent commits e2cdf2d

Comments (0)

Files changed (1)

 -module(fibs).
--export([fibs/1]).
+-export([fibs/1,fibs_loop/1]).
 
 fibs(0) -> 1;
 fibs(1) -> 1;
 fibs(N) ->
     N * fibs(N-1).
+
+fibs_loop(N) ->
+    receive
+	"fibs" ->
+	    io:format("The next fib is ~p~n", [fibs(N)]),
+	    fibs_loop(N+1);
+	_ ->
+	    io:format("I don't know what you mean~n"),
+	    fibs_loop(N)
+    end.