# loop

[Swift](https://lochiwei.gitbook.io/ios/swift) ⟩ [flow control](https://lochiwei.gitbook.io/ios/swift/flow) ⟩ loop

{% hint style="success" %}
a [statement](https://lochiwei.gitbook.io/ios/swift/statement "mention") that allows a <mark style="color:yellow;">**block of code**</mark> to be executed <mark style="color:orange;">**repeatedly**</mark>.
{% endhint %}

{% tabs %}
{% tab title="📗 參考" %}

* [x] Sundell ⟩ [Loops](https://www.swiftbysundell.com/basics/loops/)
* [ ] Sarun ⟩ [How to get index and value from for loop in Swift](https://sarunw.com/posts/swift-for-loop-with-index/)
  {% endtab %}

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

* [for...in](https://lochiwei.gitbook.io/ios/swift/flow/loop/for...in "mention")
* while 🚧
* repeat...while 🚧
  {% endtab %}

{% tab title="👥 相關" %}

* <mark style="color:purple;">**loop**</mark> is a <mark style="color:yellow;">**control flow**</mark> [statement](https://lochiwei.gitbook.io/ios/swift/statement "mention").
  {% endtab %}

{% tab title="⭐️ 重點" %}
{% hint style="info" %}
GRAMMAR OF A LOOP STATEMENT

* loop-statement → [for-in-statement](https://docs.swift.org/swift-book/ReferenceManual/Statements.html#grammar_for-in-statement)
* loop-statement → [while-statement](https://docs.swift.org/swift-book/ReferenceManual/Statements.html#grammar_while-statement)
* loop-statement → [repeat-while-statement](https://docs.swift.org/swift-book/ReferenceManual/Statements.html#grammar_repeat-while-statement)
  {% endhint %}
  {% endtab %}

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

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