Skip to content

Commit be31628

Browse files
committed
Adjust wording
1 parent 13ffd62 commit be31628

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed

TSPL.docc/LanguageGuide/Enumerations.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -479,10 +479,12 @@ case let .qrCode(productCode):
479479
```
480480
-->
481481

482-
When you're matching just one case of an enumeration,
483-
you can use the shorter `if case` syntax
482+
When you're matching just one case of an enumeration ---
483+
for example,
484+
to extract its associated value ---
485+
there's a shorter syntax you can use
484486
instead of writing a full switch statement.
485-
For example:
487+
Here's what it looks like:
486488

487489
```swift
488490
if case .qrCode(let productCode) = productBarcode {
@@ -494,8 +496,10 @@ In this code,
494496
the condition for the `if` statement starts with `case`,
495497
indicating that the condition is a pattern instead of a Boolean value.
496498
If the pattern matches,
497-
the condition for the `if` is considered to be true;
498-
otherwise it's false.
499+
the condition for the `if` is considered to be true,
500+
and the code in the body of the `if` statement runs.
501+
The patterns you can write after `if case`
502+
are the same as the patterns you can write in a switch case.
499503
Just like in the switch statement earlier,
500504
the `productBarcode` variable is matched against
501505
the pattern `.qrCode(let productCode)` here.

0 commit comments

Comments
 (0)