---
description: 🚧 施工中
---

# statement

[Swift]() ⟩ statement

{% hint style="warning" %}
Swift code consists of <mark style="color:purple;">**statements**</mark>.
{% endhint %}

{% tabs %}
{% tab title="🔴 主題" %}
* <mark style="color:yellow;">**syntax features**</mark>
  * [semicolon](statement/semicolon "mention")
* <mark style="color:yellow;">**kinds of**</mark>**&#x20;**<mark style="color:purple;">**statements**</mark>
  * [simple](statement/simple "mention") - consists of&#x20;
    * an [expr](statement/simple/expr "mention") ⭐️  (evaluated to a value)
    * or a [declaration](statement/simple/declaration "mention") ⭐️  (define new variable or type)
  * [flow](flow "mention")
    * [loop](flow/loop "mention")
    * [branch](flow/branch "mention")
    * [transfer](flow/transfer "mention")
      * break, continue, fallthrough, throw, return 🚧
  * [compiler](statement/compiler "mention")
    * conditional compilation block (#if ... #endif) 🚧
    * line control statement (#sourceLocation) 🚧
    * compile-time diagnostic statement (#error, #warning) 🚧
  * <mark style="color:yellow;">**other statements**</mark>
    * [do](statement/do "mention") statement
    * defer statement 🚧
    * labeled statement 🚧
    * availability condition (#available, ...) 🚧
{% endtab %}

{% tab title="🔸 定義" %}
{% hint style="info" %}
GRAMMAR OF A STATEMENT

* <mark style="color:green;">**statement**</mark> →&#x20;
  * [expression](https://docs.swift.org/swift-book/ReferenceManual/Expressions.html#grammar_expression) `;`opt
  * [declaration](https://docs.swift.org/swift-book/ReferenceManual/Declarations.html#grammar_declaration) `;`opt
  * [loop-statement](https://docs.swift.org/swift-book/ReferenceManual/Statements.html#grammar_loop-statement) `;`opt
  * [branch-statement](https://docs.swift.org/swift-book/ReferenceManual/Statements.html#grammar_branch-statement) `;`opt
  * [labeled-statement](https://docs.swift.org/swift-book/ReferenceManual/Statements.html#grammar_labeled-statement) `;`opt
  * [control-transfer-statement](https://docs.swift.org/swift-book/ReferenceManual/Statements.html#grammar_control-transfer-statement) `;`opt
  * [defer-statement](https://docs.swift.org/swift-book/ReferenceManual/Statements.html#grammar_defer-statement) `;`opt
  * [do-statement](https://docs.swift.org/swift-book/ReferenceManual/Statements.html#grammar_do-statement) `;`opt
  * [compiler-control-statement](https://docs.swift.org/swift-book/ReferenceManual/Statements.html#grammar_compiler-control-statement)
* <mark style="color:green;">**statements**</mark> → [statement](https://docs.swift.org/swift-book/ReferenceManual/Statements.html#grammar_statement) [statements](https://docs.swift.org/swift-book/ReferenceManual/Statements.html#grammar_statements) opt
{% endhint %}
{% endtab %}

{% tab title="📘 手冊" %}
* [ ] [Statements](https://docs.swift.org/swift-book/ReferenceManual/Statements.html)
{% endtab %}
{% endtabs %}
