So, I tried to create an asterisk pyramid using D. First of all, I noticed that concatenation seems impossible. Writing off something like this writeln("foo" + "bar")will give you a syntax error. So instead, I tried to multiply strings, as in python, which did not work with double quotes, but something strange happens with single quotes of a string.
If you enter this
import std.stdio;
void main()
{
foreach (i; 0 .. 10)
{
writeln(i*'0');
}
}
it will return a chain of integers. Can anyone explain why this is happening? And letting me know how to concatenate strings will also be very helpful.
thank!
source
share