On Monday, 23 October 2017 at 12:48:33 UTC, Atila Neves wrote:
On Monday, 23 October 2017 at 09:13:45 UTC, Satoshi wrote:
On Wednesday, 18 October 2017 at 08:56:21 UTC, Satoshi wrote:
[...]
Whats about this one?
auto foo = 42;
auto bar = "bar";
writeln(`Foo is {foo} and bar is {bar}`);
writeln("Foo is ", foo, "and bar is ", bar");
Two more characters.
Atila
Okay, but what about now?
void sendAMessage(string message)
{
....
}
Guess sendAMessage("Foo is", foo, "and bar is", bar); won't work.
However sendAMessage(`Foo is {foo} and bar is {bar}`); would have.
Your example is a common "counter-answer" to string
interpolation, but it's missing the key point that you don't
always use it for printing stuff.