On Tuesday, 10 November 2015 at 10:41:52 UTC, tired_eyes wrote:
On Tuesday, 10 November 2015 at 10:33:30 UTC, Tobias Pankrath wrote:
Ruby:
a = 1
b = 4
puts "The number #{a} is less than #{b}"

PHP:
$a = 1;
$b = 4;
echo "The number $a is less than $b";

D:
???

int a = 1, b = 4;
writefln("The number %s is less than %s", a, b);

You can't do it the ruby / perl / php way in D. It could be possible if we had AST macros in the language but as it stands now it's not possible to do that.

the closest you could get is something like this:

string s = aliasFormat!("The number $a is less than $b", a, b);

or

aliasWrite!("The number $a is less than $b", a, b);

Not really recommended though as these would end up creating lots of template bloat.






Reply via email to