You basically have three techniques.
One is to use the method itself to skip the line. Most of the time is the best solution. Just use WriteLine()
in your various variations.
WriteLine($"Segunda: {A1}, {A8}, {A4}, {3},");
WriteLine($"Terça: {A2}, {A7}, {A3}, {A6},");
You can even just skip the line :
WriteLine();
The other technique that can avoid calling this method is to place a control character in the text telling you to skip the line. This character is \n
. It will be replaced by the 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's 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 done with the verbatim flag ( @
) :
Write($@"Segunda: {A1}, {A8}, {A4}, {3},
Terça: {A2}, {A7}, {A3}, {A6}\n");
See that I used string interpolation to make the code more fluid.
Also I imported the static class to not be 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");
}
}
See working on .NET Fiddle . And at Coding Ground . Also put it on GitHub for future reference .