mercredi 8 juillet 2015

C# Error with 'continue'

I'm trying to use an if statement with a bool that will make it that if a code runs once it will not run again. Here is the code I am using.

        int random = Program._random.Next(0, 133);

        if(random < 33)
        {
            bool done = false;
            if(done)
            {
                continue;
            }
            Console.WriteLine("Not done!");
            done = true;
        }

The error that Visual Studio is displaying is: "No enclosing loop out of which to break or continue".

Aucun commentaire:

Enregistrer un commentaire