+ 1

What is the difference between console.write and console.writeline

9th Jul 2016, 12:07 PM
Ankit
Ankit - avatar
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!
10th Jul 2016, 1:55 PM
Aastha Aneja
Aastha Aneja - avatar
+ 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.
9th Jul 2016, 12:35 PM
sam da
sam da - avatar
+ 2
welcome @ankit
10th Jul 2016, 2:52 PM
Aastha Aneja
Aastha Aneja - avatar
+ 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
10th Jul 2016, 5:20 PM
shiva
0
thank you @sam and @aastha
10th Jul 2016, 2:51 PM
Ankit
Ankit - avatar