Created
April 23, 2016 19:39
-
-
Save fschuindt/fcbec81dfc27e26abc6a28014111e70e to your computer and use it in GitHub Desktop.
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
defmodule Math do | |
def zero?(0) do | |
true | |
end | |
def zero?(x) when is_integer(x) do | |
false | |
end | |
end | |
IO.puts Math.zero?(0) #=> true | |
IO.puts Math.zero?(1) #=> false | |
IO.puts Math.zero?([1, 2, 3]) #=> ** (FunctionClauseError) | |
IO.puts Math.zero?(0.0) #=> ** (FunctionClauseError) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment