Skip to content
Sharp

Language Upgrades · interview question

Which of the following is a valid use of a switch expression with pattern matching?

Multiple choiceMediumchapter-12-curatedpremiumlanguage-upgradespattern-matching
Choose one answer
Answer and explanation

Correct answer

C. Handling multiple patterns in a single case.

Why

Switch expressions with pattern matching allow handling multiple patterns in a single case by using ',' to separate them, providing a concise way to manage similar cases.

Test yourself on Language Upgrades

A free test with instant, explained results. No account needed.

Start free test
All Language Upgrades questions →