The switch statement is a conditional statement. The switch statement is like a menu, and case is like the menu option. The switch will have a variable and each case statement will have a value that this variable may be matched.
switch (Variable)
{
case FirstValue:
//Code to execute when FirstValue is matched
//...
break;
case SecondValue:
//Code to execute when SecondValue is matched
//...
break;
case ThirdValue:
//Code to execute when ThirdValueis matched
//...
break;
default:
//Default code
break;
}
Comments and Additional Information
Have some code to share? Or additional information? Respond here:
You need to be logged in to save a response on this page. The response must be constructive, helpful, supplimentary or to correct the existing video, code or narrative content.