switch statement
nounUK /swɪtʃ ˈsteɪtmənt/
US /swɪtʃ ˈsteɪtmənt/
A switch statement is a computer instruction that picks one choice from a list based on a value.
The program used a switch statement to show the right day of the week.
RELATED WORDS
OTHER MEANINGS
2. A programming construct that compares one value against several possible cases and runs the matching block.
She replaced the long if-else chain with a cleaner switch statement.
3. A control structure often used with an integer or character variable to direct program flow.
The menu was handled by a switch statement on the user's choice.
4. A branching statement that may include a default case when no other case matches.
Add a default case to the switch statement so unexpected input is handled.