There are multiple Console.WriteLine() arguments between some values, but I don't want to give them all separately by copypaste, is there any way I can specify the number of WriteLine arguments with just one argument and it'll be done .
here is some example
int[] arr1 = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 };// giving values
int[] arr2 = { 34444, 111 };
loop();//calling the method
Console.WriteLine();
Console.WriteLine();
Console.WriteLine();
Console.WriteLine();
Console.WriteLine();
printArray(arr1);//passing arrays
Console.WriteLine();
Console.WriteLine();
printArray(arr2);
Console.WriteLine();
Console.WriteLine();
minArray(arr1);
Console.WriteLine();
Console.WriteLine();
minArray(arr2);
Console.WriteLine();
Console.WriteLine();
maxArray(arr1);
Console.WriteLine();
Console.WriteLine();
maxArray(arr2);
The best approach would be to create a function that prints '\n' (symbol of new line) as many times as you need.
new Stringcan help us with repetition of '\n'.So the function might look like this:
You might notice
n-1inside the function.We added it just because WriteLine puts one
\ninto console itself.Here is an example of usage:
It will print
Hellofollowed by 5 blank lines followed byAnother Hello