<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div><blockquote type="cite" class=""><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class=""><div class=""><section class="section" style="padding: 0px; margin: 30px 0px 0px; font-family: Helvetica, Arial, sans-serif; font-size: 10px;"><div class="syntax-defs" style="border-width: 0px 0px 0px 5px; border-left-style: solid; border-left-color: rgb(233, 233, 233); font-size: 1.4em; margin: 20px 0px; outline: 0px; padding: 0px 0px 0px 15px; vertical-align: baseline; line-height: 20.299999237060547px;"><p class="syntax-defs-name" style="border: 0px; font-size: 0.63em; margin: 0px 0px 8px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(128, 128, 128); letter-spacing: 2px; text-transform: uppercase;"><br class="">GRAMMAR OF A GUARD STATEMENT</p><div class="syntax-defs-group" style="border: 0px; margin: 0px 0px 12px; outline: 0px; padding: 0px; vertical-align: baseline;"><div style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;" class=""><a name="//apple_ref/swift/grammar/guard-statement" style="border: 0px; margin: -85px 0px 0px; outline: 0px; padding: 85px 0px 0px; vertical-align: baseline; display: block; width: 0px; height: 0px; color: rgb(0, 136, 204);" class=""></a><span class="syntax-def-name" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(128, 128, 128); font-style: italic;">guard-statement </span><span class="arrow" style="border: 0px; margin: 0px; outline: 0px; padding: 0px 0px 0px 4px; vertical-align: baseline; color: rgb(128, 128, 128);">→ </span><code class="literal" style="border: 0px; font-size: 0.86em; margin: 0px; outline: 0px; padding: 0px 4px; vertical-align: baseline; font-family: Menlo, monospace; font-weight: 600; word-wrap: break-word;">guard</code><span class="syntactic-cat" style="border: 0px; margin: 0px; outline: 0px; padding: 0px 4px; vertical-align: baseline; font-style: italic; word-break: keep-all;"><a href="https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Statements.html#//apple_ref/swift/grammar/condition-clause" data-renderer-version="2" data-id="//apple_ref/swift/grammar/condition-clause" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(0, 136, 204); text-decoration: none;" class="">condition-clause</a></span><code class="literal" style="border: 0px; font-size: 0.86em; margin: 0px; outline: 0px; padding: 0px 4px; vertical-align: baseline; font-family: Menlo, monospace; font-weight: 600; word-wrap: break-word;">else</code><span class="syntactic-cat" style="border: 0px; margin: 0px; outline: 0px; padding: 0px 4px; vertical-align: baseline; font-style: italic; word-break: keep-all;"><a href="https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Declarations.html#//apple_ref/swift/grammar/code-block" data-renderer-version="2" data-id="//apple_ref/swift/grammar/code-block" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(0, 136, 204); text-decoration: none;" class="">code-block</a></span></div></div></div></section></div><div class=""><div class="syntax-defs-group" style="border: 0px; font-size: 14px; margin: 0px 0px 12px; outline: 0px; padding: 0px; vertical-align: baseline; font-family: Helvetica, Arial, sans-serif;"><div style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;" class=""><a name="//apple_ref/swift/grammar/condition-clause" style="border: 0px; margin: -85px 0px 0px; outline: 0px; padding: 85px 0px 0px; vertical-align: baseline; display: block; width: 0px; height: 0px; color: rgb(0, 136, 204);" class=""></a><span class="syntax-def-name" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(128, 128, 128); font-style: italic;">condition-clause </span><span class="arrow" style="border: 0px; margin: 0px; outline: 0px; padding: 0px 0px 0px 4px; vertical-align: baseline; color: rgb(128, 128, 128);">→ </span><span class="syntactic-cat" style="border: 0px; margin: 0px; outline: 0px; padding: 0px 4px; vertical-align: baseline; font-style: italic; word-break: keep-all;"><a href="https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Expressions.html#//apple_ref/swift/grammar/expression" data-renderer-version="2" data-id="//apple_ref/swift/grammar/expression" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(0, 136, 204); text-decoration: none;" class="">expression</a></span></div><div style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;" class=""><a name="//apple_ref/doc/uid/TP40014097-CH33-NoLink_501" style="border: 0px; margin: -85px 0px 0px; outline: 0px; padding: 85px 0px 0px; vertical-align: baseline; display: block; width: 0px; height: 0px; color: rgb(0, 136, 204);" class=""></a><span class="syntax-def-name" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(128, 128, 128); font-style: italic;">condition-clause </span><span class="arrow" style="border: 0px; margin: 0px; outline: 0px; padding: 0px 0px 0px 4px; vertical-align: baseline; color: rgb(128, 128, 128);">→ </span><span class="syntactic-cat" style="border: 0px; margin: 0px; outline: 0px; padding: 0px 4px; vertical-align: baseline; font-style: italic; word-break: keep-all;"><a href="https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Expressions.html#//apple_ref/swift/grammar/expression" data-renderer-version="2" data-id="//apple_ref/swift/grammar/expression" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(0, 136, 204); text-decoration: none;" class="">expression</a></span><code class="literal" style="border: 0px; font-size: 0.86em; margin: 0px; outline: 0px; padding: 0px 4px; vertical-align: baseline; font-family: Menlo, monospace; font-weight: 600; word-wrap: break-word;">,</code><span class="syntactic-cat" style="border: 0px; margin: 0px; outline: 0px; padding: 0px 4px; vertical-align: baseline; font-style: italic; word-break: keep-all;"><a href="https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Statements.html#//apple_ref/swift/grammar/condition-list" data-renderer-version="2" data-id="//apple_ref/swift/grammar/condition-list" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(0, 136, 204); text-decoration: none;" class="">condition-list</a></span></div><div style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;" class=""><a name="//apple_ref/doc/uid/TP40014097-CH33-NoLink_502" style="border: 0px; margin: -85px 0px 0px; outline: 0px; padding: 85px 0px 0px; vertical-align: baseline; display: block; width: 0px; height: 0px; color: rgb(0, 136, 204);" class=""></a><span class="syntax-def-name" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(128, 128, 128); font-style: italic;">condition-clause </span><span class="arrow" style="border: 0px; margin: 0px; outline: 0px; padding: 0px 0px 0px 4px; vertical-align: baseline; color: rgb(128, 128, 128);">→ </span><span class="syntactic-cat" style="border: 0px; margin: 0px; outline: 0px; padding: 0px 4px; vertical-align: baseline; font-style: italic; word-break: keep-all;"><a href="https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Statements.html#//apple_ref/swift/grammar/condition-list" data-renderer-version="2" data-id="//apple_ref/swift/grammar/condition-list" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(0, 136, 204); text-decoration: none;" class="">condition-list</a></span></div><div style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;" class=""><a name="//apple_ref/doc/uid/TP40014097-CH33-NoLink_503" style="border: 0px; margin: -85px 0px 0px; outline: 0px; padding: 85px 0px 0px; vertical-align: baseline; display: block; width: 0px; height: 0px; color: rgb(0, 136, 204);" class=""></a><span class="syntax-def-name" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(128, 128, 128); font-style: italic;">condition-clause </span><span class="arrow" style="border: 0px; margin: 0px; outline: 0px; padding: 0px 0px 0px 4px; vertical-align: baseline; color: rgb(128, 128, 128);">→ </span><span class="syntactic-cat" style="border: 0px; margin: 0px; outline: 0px; padding: 0px 4px; vertical-align: baseline; font-style: italic; word-break: keep-all;"><a href="https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Statements.html#//apple_ref/swift/grammar/availability-condition" data-renderer-version="2" data-id="//apple_ref/swift/grammar/availability-condition" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(0, 136, 204); text-decoration: none;" class="">availability-condition</a></span><code class="literal" style="border: 0px; font-size: 0.86em; margin: 0px; outline: 0px; padding: 0px 4px; vertical-align: baseline; font-family: Menlo, monospace; font-weight: 600; word-wrap: break-word;">,</code><span class="syntactic-cat" style="border: 0px; margin: 0px; outline: 0px; padding: 0px 4px; vertical-align: baseline; font-style: italic; word-break: keep-all;"><a href="https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Expressions.html#//apple_ref/swift/grammar/expression" data-renderer-version="2" data-id="//apple_ref/swift/grammar/expression" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(0, 136, 204); text-decoration: none;" class="">expression</a></span></div></div><div class="syntax-defs-group" style="border: 0px; font-size: 14px; margin: 0px 0px 12px; outline: 0px; padding: 0px; vertical-align: baseline; font-family: Helvetica, Arial, sans-serif;"><div style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;" class=""><a name="//apple_ref/swift/grammar/condition-list" style="border: 0px; margin: -85px 0px 0px; outline: 0px; padding: 85px 0px 0px; vertical-align: baseline; display: block; width: 0px; height: 0px; color: rgb(0, 136, 204);" class=""></a><span class="syntax-def-name" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(128, 128, 128); font-style: italic;">condition-list </span><span class="arrow" style="border: 0px; margin: 0px; outline: 0px; padding: 0px 0px 0px 4px; vertical-align: baseline; color: rgb(128, 128, 128);">→ </span><span class="alternative" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; display: inline;"><span class="syntactic-cat" style="border: 0px; margin: 0px; outline: 0px; padding: 0px 4px; vertical-align: baseline; font-style: italic; word-break: keep-all;"><a href="https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Statements.html#//apple_ref/swift/grammar/condition" data-renderer-version="2" data-id="//apple_ref/swift/grammar/condition" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(0, 136, 204); text-decoration: none;" class="">condition</a></span> </span><span class="alternative" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; display: inline;"> <span class="syntactic-cat" style="border: 0px; margin: 0px; outline: 0px; padding: 0px 4px; vertical-align: baseline; font-style: italic; word-break: keep-all;"><a href="https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Statements.html#//apple_ref/swift/grammar/condition" data-renderer-version="2" data-id="//apple_ref/swift/grammar/condition" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(0, 136, 204); text-decoration: none;" class="">condition</a></span><code class="literal" style="border: 0px; font-size: 0.86em; margin: 0px; outline: 0px; padding: 0px 4px; vertical-align: baseline; font-family: Menlo, monospace; font-weight: 600; word-wrap: break-word;">,</code><span class="syntactic-cat" style="border: 0px; margin: 0px; outline: 0px; padding: 0px 4px; vertical-align: baseline; font-style: italic; word-break: keep-all;"><a href="https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Statements.html#//apple_ref/swift/grammar/condition-list" data-renderer-version="2" data-id="//apple_ref/swift/grammar/condition-list" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(0, 136, 204); text-decoration: none;" class="">condition-list</a></span></span></div><div style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;" class=""><a name="//apple_ref/swift/grammar/condition" style="border: 0px; margin: -85px 0px 0px; outline: 0px; padding: 85px 0px 0px; vertical-align: baseline; display: block; width: 0px; height: 0px; color: rgb(0, 136, 204);" class=""></a><span class="syntax-def-name" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(128, 128, 128); font-style: italic;">condition </span><span class="arrow" style="border: 0px; margin: 0px; outline: 0px; padding: 0px 0px 0px 4px; vertical-align: baseline; color: rgb(128, 128, 128);">→ </span><span class="alternative" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; display: inline;"><span class="syntactic-cat" style="border: 0px; margin: 0px; outline: 0px; padding: 0px 4px; vertical-align: baseline; font-style: italic; word-break: keep-all;"><a href="https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Statements.html#//apple_ref/swift/grammar/availability-condition" data-renderer-version="2" data-id="//apple_ref/swift/grammar/availability-condition" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(0, 136, 204); text-decoration: none;" class="">availability-condition</a></span> </span><span class="alternative" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; display: inline;"> <span class="syntactic-cat" style="border: 0px; margin: 0px; outline: 0px; padding: 0px 4px; vertical-align: baseline; font-style: italic; word-break: keep-all;"><a href="https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Statements.html#//apple_ref/swift/grammar/case-condition" data-renderer-version="2" data-id="//apple_ref/swift/grammar/case-condition" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(0, 136, 204); text-decoration: none;" class="">case-condition</a></span> </span><span class="alternative" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; display: inline;"> <span class="syntactic-cat" style="border: 0px; margin: 0px; outline: 0px; padding: 0px 4px; vertical-align: baseline; font-style: italic; word-break: keep-all;"><a href="https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Statements.html#//apple_ref/swift/grammar/optional-binding-condition" data-renderer-version="2" data-id="//apple_ref/swift/grammar/optional-binding-condition" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(0, 136, 204); text-decoration: none;" class="">optional-binding-condition</a></span></span></div><div style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;" class=""><a name="//apple_ref/swift/grammar/case-condition" style="border: 0px; margin: -85px 0px 0px; outline: 0px; padding: 85px 0px 0px; vertical-align: baseline; display: block; width: 0px; height: 0px; color: rgb(0, 136, 204);" class=""></a><span class="syntax-def-name" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(128, 128, 128); font-style: italic;">case-condition </span><span class="arrow" style="border: 0px; margin: 0px; outline: 0px; padding: 0px 0px 0px 4px; vertical-align: baseline; color: rgb(128, 128, 128);">→ </span><code class="literal" style="border: 0px; font-size: 0.86em; margin: 0px; outline: 0px; padding: 0px 4px; vertical-align: baseline; font-family: Menlo, monospace; font-weight: 600; word-wrap: break-word;">case</code><span class="syntactic-cat" style="border: 0px; margin: 0px; outline: 0px; padding: 0px 4px; vertical-align: baseline; font-style: italic; word-break: keep-all;"><a href="https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Patterns.html#//apple_ref/swift/grammar/pattern" data-renderer-version="2" data-id="//apple_ref/swift/grammar/pattern" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(0, 136, 204); text-decoration: none;" class="">pattern</a></span><span class="syntactic-cat" style="border: 0px; margin: 0px; outline: 0px; padding: 0px 4px; vertical-align: baseline; font-style: italic; word-break: keep-all;"><a href="https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Declarations.html#//apple_ref/swift/grammar/initializer" data-renderer-version="2" data-id="//apple_ref/swift/grammar/initializer" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(0, 136, 204); text-decoration: none;" class="">initializer</a></span><span class="optional" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;"><span class="syntactic-cat" style="border: 0px; margin: 0px; outline: 0px; padding: 0px 4px; vertical-align: baseline; font-style: italic; word-break: keep-all;"><a href="https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/Statements.html#//apple_ref/swift/grammar/where-clause" data-renderer-version="2" data-id="//apple_ref/swift/grammar/where-clause" style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline; color: rgb(0, 136, 204); text-decoration: none;" class="">where-clause</a></span><sub class="subscript" style="border: 0px; font-size: 0.8em; margin: 0px 0px 0px -2px; outline: 0px; padding: 0px 4px 0px 0px; color: rgb(128, 128, 128); font-style: italic;">opt</sub></span></div></div><div class="syntax-defs-group" style="border: 0px; font-size: 14px; margin: 0px 0px 12px; outline: 0px; padding: 0px; vertical-align: baseline; font-family: Helvetica, Arial, sans-serif;"><div style="border: 0px; margin: 0px; outline: 0px; padding: 0px; vertical-align: baseline;" class=""></div></div></div></div></div></blockquote><br class=""></div><div><div>While the easiest solution allows commas interchangeably with `where`, it would allow construction of statements like this and</div><div>it wouldn't introduce the ability to mix and match Boolean expressions, availability conditions, case conditions, and optional binding conditions.</div><div><font face="Menlo" class=""><br class=""></font></div><div><span style="font-family: Menlo;" class="">// where-clause → (where | ,) where-expression</span></div><div><span style="font-family: Menlo;" class="">for i in 0...10, i % 2 == 0 { print(i) }</span></div><div><br class=""></div><div>To get that you need:</div><div><br class=""></div><div><div><font face="Menlo" class="">condition-list → condition | expression | condition , condition-list | expression, condition-list</font></div><div class=""><br class=""></div></div></div>Which means that `guard` would be redefined to:<div class=""><br class=""></div><div class=""><font face="Menlo" class="">guard condition-list else code-block</font></div><div class=""><br class=""></div><div class="">This would affect `while`, `repeat-while`, `if`, and `guard`.</div><div class=""><br class=""></div><div class="">-- E</div><div class=""><br class=""></div></body></html>