Skip to content

Instantly share code, notes, and snippets.

@scsibug
Created February 9, 2012 01:22
Show Gist options
  • Save scsibug/1776230 to your computer and use it in GitHub Desktop.
Save scsibug/1776230 to your computer and use it in GitHub Desktop.
Count to ten
-module(count_ten).
-export([count_ten/0]).
% Write a unction that uses recursion to count to ten.
count_ten() -> cnt(0).
cnt(X) ->
io:format("~p~n",[X]),
if (X < 10) -> cnt(X+1);
true -> nothing
end.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment