View Single Post
Old 07-05-2016, 12:03 AM   #3
smmexpertss
Registered User
 
Join Date: Sep 2015
Location: UK
Posts: 447
The condition of a switch statement is a value. The case says that if it has the value of whatever is after that case then do whatever follows the colon. The break is used to break out of the case statements. Break is a keyword that breaks out of the code block, usually surrounded by braces, which it is in. In this case, break prevents the program from falling through and executing the code in all the other case statements. An important thing to note about the switch statement is that the case values may only be constant integral expressions.
smmexpertss is offline   Reply With Quote