Reputation: 2308
I would like to know if there is any function in Erlang for writing
io:format("An output line~n").
in the standard output, without having to write ~n
every time, i.e. an equivalent to Java's
System.out.println("An output line");
I mean an already existing Erlang function. I know if it doesn't exist what I should do is creating my own function for that:
write_output(Text) ->
io:format("~p~n", [Text]).
Upvotes: 5
Views: 4116
Reputation: 436
Today, IODevice command is optional for io operations.
io:write(["~cmd1~cmd2",]T)
format, read & write can all be used in one line. as..
io:format(T);
% or
io:write(T);
but if there is a need for the line feed, the author's original code is more accurate
io:format("~p~n",[Number])
if building a function other built-in functions may be used to do the same
io:format(string:concat(integer_to_list(Number),"\n"))
Upvotes: 0
Reputation: 18869
No, there is not, but writing one yourself is pretty simple:
myf(FS, Opts) ->
io:format(FS, Opts),
io:nl().
Upvotes: 5