This is an example of the syntax I tried and don't want to use \n
.
Console.WriteLine("x"
"x"
"x"
"x"
"x");
One call should yield:
x x x x x
To break a single statement into multiple linesUse the line-continuation character, which is an underscore ( _ ), at the point at which you want the line to break.
You can have a string split across multiple lines by enclosing it in triple quotes. Alternatively, brackets can also be used to spread a string into different lines. Moreover, backslash works as a line continuation character in Python. You can use it to join text on separate lines and create a multiline string.
By using: \n – It prints new line. By using: \x0A or \xA (ASCII literal of \n) – It prints new line. By using: Console. WriteLine() – It prints new line.
"\n" can be used for a new line character, or if you are printing the same thing multiple times then a for loop should be used.
One call shouldn't yield that, because you've got two string literals. In fact, that won't even compile...
Try:
Console.WriteLine("x\nx");
Or at worse:
Console.WriteLine(@"x
x");
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With