Skip to content

Instantly share code, notes, and snippets.

@gtcarlos
Created January 18, 2016 12:47
Show Gist options
  • Save gtcarlos/353427c518e7647cbcee to your computer and use it in GitHub Desktop.
Save gtcarlos/353427c518e7647cbcee to your computer and use it in GitHub Desktop.
Crackle Pop Elixir
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