I have the following Elixir function:
defp prod(a, b\\0) do
a*b
end
On compiling, I get the warning:
warning: default arguments in prod/2 are never used
Why does it think the default value won't be used?
Edit: here's the gist, if you want to take a look at the whole thing https://gist.github.com/findjashua/2ed4204247d76849eb81
It will warn you that the default arguments aren't used if you never call prod with a single argument in that module. I'm assuming somewhere you are calling prod with prod(someA, someB), but never prod(someA).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With