You have basically three techniques.
One is to use the method itself to skip the line. Most of the time it is the best solution. Just use the WriteLine()
, in its various variations.
WriteLine($"Segunda: {A1}, {A8}, {A4}, {3},");
WriteLine($"Terça: {A2}, {A7}, {A3}, {A6},");
May even just skip the line:
WriteLine();
The other technique that can avoid calling this method is to put a control character in the text telling you to skip the line. This character is the \n
. It will be replaced by line break.
Write($"Segunda: {A1}, {A8}, {A4}, {3},\n");
Write($"Terça: {A2}, {A7}, {A3}, {A6}\n");
Or where it makes the most sense:
Write($"Segunda: {A1}, {A8}, {A4}, {3},\nTerça: {A2}, {A7}, {A3}, {A6}\n");
It is important to note that this should not be abused. In this example the ideal would be to use another method. It is more readable.
The other technique is to skip the line in the code itself, for this it is necessary to indicate that the text will be raw, that is, it should be used the way it is in the code. This is achieved with the Verbatim indicator (@
):
Write($@"Segunda: {A1}, {A8}, {A4}, {3},
Terça: {A2}, {A7}, {A3}, {A6}\n");
See what I used interpolation of string to make the code more fluid.
Also imported the static class not to keep typing Console
all the time.
using static System.Console;
public class Program {
public static void Main() {
var A1 = ReadLine();
var A2 = ReadLine();
var A3 = ReadLine();
var A4 = ReadLine();
var A5 = ReadLine();
var A6 = ReadLine();
var A7 = ReadLine();
var A8 = ReadLine();
WriteLine($"Segunda: {A1}, {A8}, {A4}, {3},");
WriteLine($"Terça: {A2}, {A7}, {A3}, {A6},");
Write($"Segunda: {A1}, {A8}, {A4}, {3},");
WriteLine();
Write($"Terça: {A2}, {A7}, {A3}, {A6},");
Write($"Segunda: {A1}, {A8}, {A4}, {3},\nTerça: {A2}, {A7}, {A3}, {A6}\n");
Write($@"Segunda: {A1}, {A8}, {A4}, {3},
Terça: {A2}, {A7}, {A3}, {A6}\n");
}
}
Behold working in the ideone. And in the .NET Fiddle. Also put on the Github for future reference.