Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- defmodule Example do
- def example_function do
- x = true
- case x do
- false > IO.inspect("Wrong")
- true > IO.inspect("Yupp")
- _ > IO.inspect("If neither we catch all")
- end
- end
- ### Or you can do
- def caller_function do
- cond_function(true)
- end
- def cond_function(false), do: "wrong"
- def cond_function(true), do: "Yupp"
- def cond_function(_), do: "If neither we catch all"
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement