+ 1
What is the difference between console.write and console.writeline
5 Réponses
+ 10
if you use Console.Write then any thing that will be printed after that will be printed in the same line and if you use Console.WriteLine then anything that will be printed after that will be printed in a new line. For example-
Console.Write("Hey!");
Console.Write("Hello!");
will give you the following output:
Hey!Hello!
while theis code:
Console.WriteLine("Hey!");
Console.WriteLine("Hello!");
will give you the following output:
Hey!
Hello!
+ 2
Console.WriteLine ends the line. that means the next Console.Write or Console.WriteLine output starts in the next line.
Console.Write not ends the line. the next output stards on the end of the Console.Write output.
+ 2
welcome @ankit
+ 1
console.write will write the content to the console and cursor remains in same
where as console.write line will write the content and the cursor points to next line
0
thank you @sam and @aastha