Created
February 19, 2015 17:53
-
-
Save rusted/0dbd3bd6efc4ebf15d06 to your computer and use it in GitHub Desktop.
fizzbuzz ?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-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