I am building a simple tic tac toe program in Erlang. I pass the board as a string to io:format("123\n456\n789\n")
and want to see:
123
456
789
But in the Erlang shell io:format("123\n456\n789\n")
prints this:
123
456
789
ok
Is there a way to output to the console without the trailing ok?
The ok
is there to tell you that the call worked. The spec for the function io:format specifies this.
The real problem here is that you are seeing a mixture of the erlang terminal, and whatever is comming from stdout - stdout is printing the numbers, and the erlang terminal is giving back the ok
.
if you were writing a script using escript, the ok stratement will not be printed to standart output - you should simply think of the console as an interactive interpreter.
As a side note the easiest way to output:
123
456
789
Would be
1> 123. 456. 789.
123
456
789