Reputation: 1422
Is there any construction or maybe other function to do something like this:
Var = "hello",
io:format("My text is ~s[1]. And again: ~s[1]", Var).
So the output will be:
My text is hello. And again: hello
Upvotes: 0
Views: 59
Reputation: 30985
It seems overkill to me, but you could do something like:
Vars = lists:duplicate(3, "hello").
io:format("One: ~s, two: ~s, three: ~s.", Vars).
Upvotes: 1
Reputation: 26
Upvotes: 1