[erlang-questions] Newbie Question about io:format

Hakim Fajardo <>
Wed Feb 22 20:13:02 CET 2017


Thank you! I see now.

On Tue, Feb 21, 2017 at 7:17 PM, Richard A. O'Keefe <>
wrote:

> On 21/02/17 10:15 PM, Hakim Fajardo wrote:
> (simplified):
>
> prices([]) ->
>     io:format("List is empty~n");
> prices(L) when is_list(L) ->
>     io:format("The average equals ~n", lists:sum(L)/length(L)).
>               ^^^^^^^^^^^^^^^^^^^^^^^
>
> % man io
>        format(Format, Data) -> ok
>                  Data = [term()]
>
> The second argument of io:format/2 should be a list.
>
> What part of the format says to expect a number?
> What part of the format says how to print a number?
>
>
> _______________________________________________
> erlang-questions mailing list
> 
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20170222/8afbbd26/attachment.html>


More information about the erlang-questions mailing list