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)
.
Elixir warning: default arguments are never used
-
19-07-2023 - |
Question
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
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow