Skip to content

Instantly share code, notes, and snippets.

@wsmoak
Last active August 29, 2015 14:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wsmoak/eb4856f27a2b958fc46e to your computer and use it in GitHub Desktop.
Save wsmoak/eb4856f27a2b958fc46e to your computer and use it in GitHub Desktop.
In this bit of http://elixir-lang.org/getting-started/case-cond-and-if.html
Clauses also allow extra conditions to be specified via guards:
iex> case {1, 2, 3} do
...> {1, x, 3} when x > 0 ->
...> "Will match"
...> _ ->
...> "Won't match"
...> end
"Will match"
... shouldn't the 5th line (line # 9 above) be "Would match" since _ always matches,
it just won't get the chance in this case because line 6 matched first?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment