enum - error
Xcode4-OTHER, Mac OS X (10.6.7)
Want to highlight a helpful answer? Upvote!
Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >
Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >
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;
}
caseOptions:
{
// Do something else.
break;
}
case Help:
{
// Do something else.
break;
}
default:
{
// Do something when variable is not Play, Options or Help.
break;
}
}
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;
}
caseOptions:
{
// Do something else.
break;
}
case Help:
{
// Do something else.
break;
}
default:
{
// Do something when variable is not Play, Options or Help.
break;
}
}
Adding the "int variable = Play;" fixed the errors.
Thank you for your help.
enum - error