How to loop a switch?

Hello,

How would you make the 'default' in a switch statement, repeat the switch statement over again?

Simple solution, put the switch in a function where the default case calls itself (the funtion). This is not a solution to every issue like this but it should work.
Last edited on
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
bool keeplooping;

do
{
  keeplooping = false;

  switch(...)
  {
    ...

  default:
    keeplooping = true;
    break;
  }
}while(keeplooping);
Thanks Disch.

It worked.
Topic archived. No new replies allowed.