Here is my module:
defmodule Test do
def try(10 = num, other_num \\ 10) do
num + other_num
end
def try(_num, _other_num) do
raise "This is incorrect"
end
end
When I run iex I get this warning:
warning: def try/2 has multiple clauses and also declares default values. In such cases, the default values should be defined in a header. Instead of:
def foo(:first_clause, b \\ :default) do ... end
def foo(:second_clause, b) do ... end
one should write:
def foo(a, b \\ :default)
def foo(:first_clause, b) do ... end
def foo(:second_clause, b) do ... end
I honestly have no idea what this is trying to tell me to do. Can anyone break this down for me, what is the compiler want me to do here? Thank you!