What is the difference between Console.ReadLine(); and Console.Read(); | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the difference between Console.ReadLine(); and Console.Read();

13th Jul 2016, 12:03 PM
chaitanya guruprasad
chaitanya guruprasad - avatar
3 Answers
+ 6
Console.WriteLine("your text"); writes your text and goes to new line, while Console.Write("your text") would stay in the same line, eg: for(int i=0; i < 5; i++) { Console.WriteLine(i); } gives: 0 1 2 3 4 While: for (int i = 0; i < 5; i++) { Console.Write(i); } gives: 01234
13th Jul 2016, 12:18 PM
Tomek Cymes
Tomek Cymes - avatar
+ 2
Console.ReadLine() returns everything you typed in the console, while Console.Read() inly the first character
13th Jul 2016, 12:11 PM
Tomek Cymes
Tomek Cymes - avatar
0
is the same explanation valid for Console.WriteLine() and Console.Write()?
13th Jul 2016, 12:15 PM
chaitanya guruprasad
chaitanya guruprasad - avatar