Is there any way to get some input DURING the execution of my program and not at the beginning (c#) | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is there any way to get some input DURING the execution of my program and not at the beginning (c#)

4th Nov 2016, 7:34 PM
ih01
ih01 - avatar
5 Answers
0
What type of application are you creating?
4th Nov 2016, 7:53 PM
Michael Dolence
0
just a console game in c#
4th Nov 2016, 8:31 PM
ih01
ih01 - avatar
0
Well, you can put input inside infinite loop. For example: string input; while(true){ input = Console.ReadLine(); if(input == "exit"){ Console.WriteLine("Until next time!"); break; } else if(input == "stats"){ //Print or call some methods here and so on. } } Anyway, If you want something more complex and, for example, read user input WHILE something goes on in the background, lets say, some output or calculations, you should consider using threads.
4th Nov 2016, 8:56 PM
Karolis Strazdas
Karolis Strazdas - avatar
0
Please could you add your code so we can try and provide a solution.
4th Nov 2016, 10:34 PM
Harry Pearson
Harry Pearson - avatar
0
i mean that i want to do that in code playground, in VS i know how to do it, but code playground asks to enter all values before running the code
5th Nov 2016, 11:56 AM
ih01
ih01 - avatar