7
Answers

Loop the switch

Frohikki

Frohikki

12y
3.9k
1
Hi 
I have a switch-statement and three case's. But now I need the switch to start over when it's done with case 2. Ive tried a while loop but it dosen't seems to help. Is there any other way?

 switch (row)//Färgalternativ
                {
                    while(true)
                    {
                    case 0:
                    Console.ForegroundColor = ConsoleColor.Yellow;
                    break;

                    case 1:
                    Console.ForegroundColor = ConsoleColor.Magenta;
                    break;

                    case 2:
                    Console.ForegroundColor = ConsoleColor.Green;
                    break;
                    }
                }
Answers (7)
Next Recommended Forum