0
how to use a for loop to repeat a question
i want to use for loops to ask a question so the user will continue to input the name
3 Réponses
+ 4
where is your try???, finish the C# course and you will be able to do that
+ 1
// for loop
//your question in the for loop
//???
//profit
+ 1
I would use a while loop?
As soon as you don't want the code to repeat, just put in a false state and you're out of the loop.
Boolean rotate= true;
Console.WriteLine("rotate?");
while(rotate) {
int x = Convert.ToInt32(Console.ReadLine());
if(x == 0) {
rotate = false;
}
else {
Console.WriteLine("try again");
rotate = true; // this is not needed
}
}