Skip to content

Instantly share code, notes, and snippets.

@alco
Created October 2, 2014 10:35
Show Gist options
  • Save alco/b34eecc74c273b8a3c74 to your computer and use it in GitHub Desktop.
Save alco/b34eecc74c273b8a3c74 to your computer and use it in GitHub Desktop.
defmodule M do
def test do
cond do
length([1,2,3]) == 0 -> false
true
"oops, I forgot the arrow"
end
end
end
λ elixirc condi.exs
condi.exs:4: warning: this check/guard will always yield the same result
λ iex
Erlang/OTP 17 [erts-6.1] [source] [64-bit] [smp:8:8] [ds:8:8:10] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
Interactive Elixir (0.15.1) - press Ctrl+C to exit (type h() ENTER for help)
iex(1)> M.test
** (CondClauseError) no cond clause evaluated to a true value
M.test/0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment