I have a piece of code:
int n = 0;
for (int i = 0; i < 50;i++)
{
n = checkStatus();
switch (n)
{
case 1:
break;
break;
}
}
As described in the comment, I cannot complete the For Loop loop directly from the switch only if I declare a boolean and in the switch completion test
if(LoopShouldTerminate)
break;
PS: or maybe I'm very confused!
[POST]
I received a message and the problem was resolved, but I would like to mention that using a switch in a for loop is not an idea of God, because I heard from many developers that I should exit the loop at the moment I receive the desired result, so when using the switch, an additional logical value is required or press the Int value i up to 50 direclty, but what happens if we use the while loop?