Skip to content

Commit f321843

Browse files
Update description to match refactored switch expression logic (#45864)
This commit complements the refactor introduced in pull request #45855. The revised description now accurately reflects the updated switch expression logic, ensuring clarity and completeness.
1 parent 72822e1 commit f321843

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Diff for: docs/csharp/fundamentals/functional/pattern-matching.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ You can use [*relational patterns*](../../language-reference/operators/patterns.
5252

5353
:::code language="csharp" source="snippets/patterns/Simulation.cs" ID="RelationalPattern":::
5454

55-
The preceding code also demonstrates the conjunctive `and` [*logical pattern*](../../language-reference/operators/patterns.md#logical-patterns) to check that both relational patterns match. You can also use a disjunctive `or` pattern to check that either pattern matches. The two relational patterns are surrounded by parentheses, which you can use around any pattern for clarity. The final two switch arms handle the cases for the melting point and the boiling point. Without those two arms, the compiler warns you that your logic doesn't cover every possible input.
55+
The preceding code also demonstrates the conjunctive `and` [*logical pattern*](../../language-reference/operators/patterns.md#logical-patterns) to check that both relational patterns match. You can also use a disjunctive `or` pattern to check that either pattern matches. The two relational patterns are surrounded by parentheses, which you can use around any pattern for clarity. The two explicit switch arms (32°F and 212°F) handle the cases for the melting point and the boiling point. Without those two arms, the compiler warns you that your logic doesn't cover every possible input.
5656

5757
The preceding code also demonstrates another important feature the compiler provides for pattern matching expressions: The compiler warns you if you don't handle every input value. The compiler also issues a warning if the pattern for a switch arm is covered by a previous pattern. That gives you freedom to refactor and reorder switch expressions. Another way to write the same expression could be:
5858

0 commit comments

Comments
 (0)