C
C#2mo ago
neu

✅ What's the difference between "Write" and "WriteLine" in C#

i honestly dont get it, it looks the same, it acts the same. Whats the difference?
4 Replies
leowest
leowest2mo ago
Write does not move you to the next line WriteLine moves you to the next line after writing whatever u told it to
Console.Write("Type your name: ");
Console.Write("My name is neu!");
Console.Write("Type your name: ");
Console.Write("My name is neu!");
This will print to the screen:
Type your name: My name is neu!
Type your name: My name is neu!
All in the same line. However if you do:
Console.WriteLine("Type your name: ");
Console.Write("My name is neu!");
Console.WriteLine("Type your name: ");
Console.Write("My name is neu!");
It will print
Type your name:
My name is neu!
Type your name:
My name is neu!
You can also read more about both methods in the docs here Console.Write Console.WriteLine
neu
neuOP2mo ago
thank you so much!!
leowest
leowest2mo ago
$close
MODiX
MODiX2mo ago
If you have no further questions, please use /close to mark the forum thread as answered
Want results from more Discord servers?
Add your server