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

# branch

[Swift](..) ⟩ [flow control]() ⟩ branch

{% hint style="success" %}
a [statement](../statement "mention") 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](branch/if "mention")
* [guard](branch/guard "mention")
* [switch](branch/switch "mention")
{% 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 %}
