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 If you type in 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. This program will print 65 and 650 because the character is being converted into integer in both cases. To resolve the basic closing problem, use 'array1 ~ = array2' to add the array '2' to operator1, or 'array1' in array1, to include two arrays. 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.
import std.stdio; Zero main () {foreach (i; 0 .. 10) {article (i * '0'); }}
import std.stdio; Int main () {writeln (cast ('a'); Written (10 * 'A'); Return 0; }
Comments
Post a Comment