d - multiplying a string by an integer returns integers? -
So I was trying to create asterisk pyramid using D. At first I saw that the combination seems impossible. Writing something like writeln ("foo" + "bar") will give you a syntax error. Instead, I tried to multiply the string like a dragon, which did not work with double quoted strings, But there is something strange with single quoted stars. If you type in import std.stdio; Zero main () {foreach (i; 0 .. 10) {article (i * '0'); }} This will return a bunch of integers. Can anyone explain why this happens? And to tell me how to add a string, it really will be helpful. Thank you! '0' is not a string, it is a character that uses ASCII encoding. The number is being multiplied with the integer ID of the encoding. For example, encoding for ASCII's 'A' is 65. import std.stdio; Int main () {writeln (cast ('a'); Written (10 * 'A'); Return 0; } This program will print 65 and 650 because the character is being...