0

C++_Need Help Understanding "Break" statements.

Learning about "Break" statements, my question is what are they used for? I was reviewing this code from SoloLearn in C++, and if I comment out the break statements, every other case inside this code gets executed, Why? https://code.sololearn.com/ckaal3Q0hcD6/?ref=app

11th Aug 2020, 6:14 PM
Raul Sanchez
Raul Sanchez - avatar
2 odpowiedzi
+ 4
Already asked question! You can read my answer for detailed explanation https://www.sololearn.com/discuss/2406604/?ref=app
11th Aug 2020, 6:19 PM
Namit Jain
Namit Jain - avatar
+ 2
Thanks for the link Namit Jain I was reading more about switch statements online and after reading some comments on the link you sent me. I now understand that the break tells the program to stop or exit out. And the following switch statements won't execute.
11th Aug 2020, 6:36 PM
Raul Sanchez
Raul Sanchez - avatar