[erlang-questions] Newbie Question about io:format

Richard A. O'Keefe ok@REDACTED
Wed Feb 22 01:17:41 CET 2017

On 21/02/17 10:15 PM, Hakim Fajardo wrote:

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?

More information about the erlang-questions mailing list