C#workingdotnet
Switch expressions and patterns
An expression-bodied switch that returns a value, paired with the pattern vocabulary that makes its arms read like a truth table.
switch as an *expression* yields a value from the first matching arm; relational (> 0), logical (and/or/not), tuple, and when-guarded patterns let each arm describe a shape instead of running statements.
A switch expression returns a value
C#intro0ms
ABF
Reference · output compiled offline, not runnable in-browser
Each arm is a constant pattern, so only the exact values 90 and 80 map to "A" and "B"; 55 matches nothing and falls through to the discard _, yielding "F". This shows the expression returns the result of the first matching arm with no fall-through.