Getting user's input multiple times in C# | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Getting user's input multiple times in C#

Hello everyone, I don't know if this question has been asked before, but I didn't find anything related to it neither in course nor in Q&A. I want to get input from user multiple times (e.g for his name, age, hobby), but when I use Console.ReadLine () it only takes input once. What syntax should I use ?

11th Jul 2018, 4:41 PM
LuciusSeverusMR
3 Answers
+ 2
You have to split your inputs with the "enter" key. Example:: When it pops up, do something like this :: First Line ---- name Second Line --- age Third Line ---- Hobby
11th Jul 2018, 4:51 PM
Dlite
Dlite - avatar
0
Use a loop
11th Jul 2018, 4:49 PM
TurtleShell
TurtleShell - avatar
0
You can only get input at the start of code execution, multiple inputs should be split into multiple lines.
11th Jul 2018, 4:50 PM
Paul Grasser
Paul Grasser - avatar