Created
January 18, 2016 12:47
-
-
Save gtcarlos/353427c518e7647cbcee to your computer and use it in GitHub Desktop.
Crackle Pop Elixir
This file contains 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
defmodule CracklePop do | |
def cpop(n) when rem(n, 3) == 0 and rem(n, 5) == 0, do: "CracklePop" | |
def cpop(n) when rem(n, 3) == 0, do: "Crackle" | |
def cpop(n) when rem(n, 5) == 0, do: "Pop" | |
def cpop(n), do: n | |
end | |
1..100 |> Enum.map(&CracklePop.cpop(&1)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment