Skip to content

Commit 41bc134

Browse files
committed
Use semantic line breaks
Removed stray whitespace at end of lines. Restored line breaks for unchanged content. Split lines in new content at clause and sentence boundaries, instead of wrapping at 80 columns.
1 parent 07b58ed commit 41bc134

File tree

1 file changed

+20
-13
lines changed

1 file changed

+20
-13
lines changed

TSPL.docc/ReferenceManual/Statements.md

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,8 @@ and a `continue` statement and is discussed in <doc:Statements#Break-Statement>
7070
A `for`-`in` statement allows a block of code to be executed
7171
once for each item in a collection (or any type)
7272
that conforms to the
73-
[`Sequence`](https://developer.apple.com/documentation/swift/sequence) protocol, or in a value parameter pack.
73+
[`Sequence`](https://developer.apple.com/documentation/swift/sequence) protocol,
74+
or in a value parameter pack.
7475

7576
A `for`-`in` statement has the following form:
7677

@@ -80,9 +81,10 @@ for <#item#> in <#expression#> {
8081
}
8182
```
8283

83-
If the *expression* of a `for`-`in` statement is a collection *expression*, the
84-
`makeIterator()` method is called on it to obtain a value of an iterator type
85-
--- that is, a type that conforms to the
84+
If the *expression* of a `for`-`in` statement is a collection *expression*,
85+
the `makeIterator()` method is called on it
86+
to obtain a value of an iterator type --- that is,
87+
a type that conforms to the
8688
[`IteratorProtocol`](https://developer.apple.com/documentation/swift/iteratorprotocol) protocol.
8789
The program begins executing a loop
8890
by calling the `next()` method on the iterator.
@@ -93,15 +95,20 @@ and then continues execution at the beginning of the loop.
9395
Otherwise, the program doesn't perform assignment or execute the *statements*,
9496
and it's finished executing the `for`-`in` statement.
9597

96-
The *expression* of a `for`-`in` statement may also be a pack expansion
97-
*expression*. In this case, on the *i*th iteration, the type of *item* is the
98-
*i*th type parameter in the type parameter pack being iterated over. The value
99-
of *item* is the pattern type of *expression*, with each captured type
100-
parameter pack replaced with an implicit scalar type parameter with matching
101-
requirements. The *expression* is evaluated once at each iteration, instead of
102-
`n` times eagerly, where `n` is the length of the packs captured by the
103-
pattern. The program will continue executing *statements* while the total
104-
length of the packs captured by the pattern isn't reached.
98+
The *expression* of a `for`-`in` statement
99+
may also be a pack expansion *expression*.
100+
In this case,
101+
on the *i*th iteration,
102+
the type of *item* is the *i*th type parameter
103+
in the type parameter pack being iterated over.
104+
The value of *item* is the pattern type of *expression*,
105+
with each captured type parameter pack replaced with
106+
an implicit scalar type parameter with matching requirements.
107+
The *expression* is evaluated once at each iteration,
108+
instead of `n` times eagerly,
109+
where `n` is the length of the packs captured by the pattern.
110+
The program will continue executing *statements*
111+
while the total length of the packs captured by the pattern isn't reached.
105112

106113
> Grammar of a for-in statement:
107114
>

0 commit comments

Comments
 (0)