34.4k views
3 votes
With the switch/case statement you must manually exit using

A) Exit command
B) Continue command
C) Break command
D) Stop command

1 Answer

6 votes

Final answer:

To manually exit a case in a switch/case statement, the correct command to use is the C) Break command. This ensures that after executing a matched case, the control is transferred out of the switch statement to prevent 'fall through'.

Step-by-step explanation:

In the context of a switch/case statement, when you want to exit a case and prevent the execution from falling through to the subsequent cases, you use the C) Break command.

Once the condition matches a case, the commands within that case will execute until a break statement is encountered, which then transfers control out of the switch statement. If a break is not present, the program will continue executing the next cases regardless of whether they match the condition or not, commonly referred to as 'fall through'.

User Poly Bug
by
8.4k points

No related questions found