Skip to content

Instantly share code, notes, and snippets.

@rusted
Created February 19, 2015 17:53
Show Gist options
  • Save rusted/0dbd3bd6efc4ebf15d06 to your computer and use it in GitHub Desktop.
Save rusted/0dbd3bd6efc4ebf15d06 to your computer and use it in GitHub Desktop.
fizzbuzz ?
-module(fizzbuzz).
-export([start/0]).
fizzbuzz(X) when X rem 15 == 0 ->
io:format("FizzBuzz~n");
fizzbuzz(X) when X rem 3 == 0 ->
io:format("Fizz~n");
fizzbuzz(X) when X rem 5 == 0 ->
io:format("Buzz~n");
fizzbuzz(X) ->
io:format("~p~n", [X]).
start() ->
lists:foreach(fun(X) -> fizzbuzz(X) end, lists:seq(1, 100)).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment