> For the complete documentation index, see [llms.txt](https://lochiwei.gitbook.io/ios/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lochiwei.gitbook.io/ios/swift/flow/branch.md).

# branch

[Swift](/ios/swift.md) ⟩ [flow control](/ios/swift/flow.md) ⟩ branch

{% hint style="success" %}
a [statement](/ios/swift/statement.md) that allows a <mark style="color:yellow;">**block of code**</mark> to be executed <mark style="color:yellow;">**only when certain**</mark>**&#x20;**<mark style="color:orange;">**conditions**</mark>**&#x20;**<mark style="color:yellow;">**are met**</mark>. (also called [conditional statements](https://docs.swift.org/swift-book/LanguageGuide/ControlFlow.html#ID127))
{% endhint %}

{% tabs %}
{% tab title="🔴 主題" %}

* [if](/ios/swift/flow/branch/if.md)
* [guard](/ios/swift/flow/branch/guard.md)
* [switch](/ios/swift/flow/branch/switch.md)
  {% endtab %}

{% tab title="🔸 定義" %}
{% hint style="info" %}

* <mark style="color:green;">**branch-statement**</mark> →&#x20;
  * [if-statement](https://docs.swift.org/swift-book/ReferenceManual/Statements.html#grammar_if-statement)
  * [guard-statement](https://docs.swift.org/swift-book/ReferenceManual/Statements.html#grammar_guard-statement)
  * [switch-statement](https://docs.swift.org/swift-book/ReferenceManual/Statements.html#grammar_switch-statement)
    {% endhint %}
    {% endtab %}

{% tab title="📘 手冊" %}

* [ ] [Statements](https://docs.swift.org/swift-book/ReferenceManual/Statements.html) ⟩ [Branch Statements](https://docs.swift.org/swift-book/ReferenceManual/Statements.html#ID434)
  {% endtab %}
  {% endtabs %}
