✅ I need to put an invalid choice in my program
I need to make the program repeat if they did not input a valid response of yes or no
22 Replies
Do a loop then
is there a easier way?
do a loop kind of broad
how do I do this
if response == yes continue to the while loop?
what kind of loop do I do?
A while loop, for example
else if (Response != "yes" && Response != "no")
{
Console.WriteLine("Invalid Choice");
break; // right here how do I get it to go back to the beginning of the loop?
Console.ReadLine();
}
I tried break and continue and it did not work
Break stops the loop. Continue goes to the top of the loop
Well
else if
is not a loopit is inside a loop
Ah, my bad, seems you already have some loops in that chunk of code
Yeah
the app closes when I put continue
what are these errors?
the top error I know the other errors
Style rule messages. Not errors
what is top one
Self explanatory
I take out the string[] args?
Yeah, that's what it's saying
should I be using switch instead of loop and if statements?
Switch doesn't loop
If doesn't loop
should I be using switch instead of if is what I meant
A lot of the time they're interchangeable
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.