[erlang-questions] A silly one?

Fred Hebert mononcqc@REDACTED
Thu Jan 28 15:37:19 CET 2010


The problem here is that you're using the function wrong.
  io:format("fac of ~p is ~p~n", N, Fac).
should be
  io:format("fac of ~p is ~p~n", [N, Fac]).

io:format takes only two arguments in your case, so the parameters to the
string need to be wrapped in a list.


On Thu, Jan 28, 2010 at 9:25 AM, Ish Rattan <ishwar@REDACTED>wrote:

>
> I can't figure out how to print a term,
> assume tht factorial(N) is given and
>
> print_it(N) ->
>   Fac = factorial(N),
>   io:format("fac of ~p is ~p~n", N, Fac).
>
> -ishwar
>
>
> ________________________________________________________________
> erlang-questions mailing list. See http://www.erlang.org/faq.html
> erlang-questions (at) erlang.org
>
>


More information about the erlang-questions mailing list