I don't really fully get what "case" And "break" are doing -- I'm mainly just copying the code there -- anyone have any helpful hints? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

I don't really fully get what "case" And "break" are doing -- I'm mainly just copying the code there -- anyone have any helpful hints?

9th Mar 2016, 12:24 AM
chris
chris  - avatar
2 Answers
+ 3
think of it as "Perform the following statements if...." then you have a list of choices (cases) you then are saying "in this case, do something" "in another case, do something else" the "something" is any number of c++ statements the break is used to indicate when to stop running the statements for a case
16th Jun 2016, 11:03 AM
Amjad Moghul
Amjad Moghul - avatar
0
Think of it as multiple choice. Each case is an option and will be output if the case is met. Break simply ends the case and serves the same purpose as a period does in a sentence.
25th Mar 2016, 2:43 AM
Bryan
Bryan - avatar