Pages

Saturday, December 29, 2012

Re: enum - error

Review the language documentation for the switch statement.

This is a sample of the correct usage:

 

enum RequestAction {Play, Options, Help};

 

int variable = Play;

switch (variable)

{

    case Play:

    {

     // Do something.

      break;

    }

    case Options:

    {

        // Do something else.

        break;

    }

    case Help:

    {

        // Do something else.

        break;

    }

    default:

    {

        // Do something when variable is not Play, Options or Help.

       break;

    }

}


View the original article here

0 comments:

Post a Comment