Difference between Console.Write and Console.WriteLine

This Question is frequently asked, so here’s the answer

The difference between them are in the Line where they’re on

If using Console.Write(), the control will stay on the same line

Example:

static void main ( string[] args);

{

Console.Write(“Ice”);

Console.Write(“Cream”);

}

Debug Output :
IceCream

If using Console.WriteLine(), the control will stay on the next line ( like enter keyboard effect )

Example:

static void main ( string[] args);

{

Console.WriteLine(“Ice”);

Console.WriteLine(“Cream”);

}

Debug Output :
Ice
Cream

Leave a Reply