1

With language like JS it's really easy to write something like:

var a = 5;
console.log(a + ' times\n');

how can I write the same code with erlang?

kharandziuk
  • 12,020
  • 17
  • 63
  • 121
  • possible duplicate of [convert an integer to a string in Erlang](http://stackoverflow.com/questions/588003/convert-an-integer-to-a-string-in-erlang) – legoscia Jun 24 '15 at 11:10

1 Answers1

4

If your question is about stringification of any Erlang term, there is ~p in io:format/2,3 function.

A = 5, io:format("~p times~n", [A]).

If you are interested in debugging output, there is also erlang:display/1 function. It works like io:format("~p~n", [X]), true..

Hynek -Pichi- Vychodil
  • 26,174
  • 5
  • 52
  • 73