0
Console,WriteLine and Write.
hello everyone!I am self studying c# at home...my parents or my family don't know anything about it..I hope you will help me learn better in detail.Thanks. now, what is the difference between write and WriteLine when you write a program, could you explain it to me? and should we write"console" in any program we write..or does it depend on situation and there are other things like console.. sorry, I don't know if you understood what I mean..I am a totally new to it, don't know anything too well.
3 Antworten
+ 1
Console.Write will basically write as stated.
Console.Writeline, will basically write and move on to the next line for the next output or input.
They can be used interchangeably depending on the need. If you are really concerned about neatness of your display then try experimenting with the two
0
Console.Write will add the text to the line where the cursor is at and leave it on that line.
Console.WriteLine will add text to the line where the cursor is at and enter a carriage return to move the cursor down to the next line.
Example:
Console.Write("Test ");
Console.Write("Same Line");
will output as
Test Same Line
Console.WriteLine("Test ");
Console.WriteLine("New Line");
will output as
Test
New Line
0
thank you very much..that was really helpfull!!