Im trying to understand creating and accessing protected functions.
I have following simple code, but I’m getting error
Im trying to call public function which in turn calls inside a protected function. What is going wrong here?
defmodule Math do
def add(a,b) do
c = a+b
Math.info(a,b,"add", c)
end
defp info(a,b,c,d) do
cond do
c == "add" -> IO.puts "Adding #{a} and #{b}, result = #{d}"
end
end
end
Math.add(1,2)
Error received
== Compilation error in file math.ex ==
** (UndefinedFunctionError) function Math.info/4 is undefined or private
Math.info(1, 2, "add", 3)
(elixir 1.10.4) lib/kernel/parallel_compiler.ex:304: anonymous fn/4 in Kernel.ParallelCompiler.spawn_workers/7