# local scope

[Swift](https://lochiwei.gitbook.io/ios/swift) ⟩ [scope](https://lochiwei.gitbook.io/ios/swift/scope) ⟩ global&#x20;

{% hint style="success" %}
A <mark style="color:purple;">local scope</mark> is formed at <mark style="color:yellow;">each new level of code orgazination</mark> below the [global scope](https://lochiwei.gitbook.io/ios/swift/scope/global). For example, a new [type](https://lochiwei.gitbook.io/ios/swift/type)╱[function](https://lochiwei.gitbook.io/ios/swift/type/category/basic/func)╱<mark style="color:orange;">code block</mark> forms a new <mark style="color:purple;">local scope</mark>.&#x20;

Based on where a symbol is declared, it's only accessible from code that is at the <mark style="color:yellow;">same</mark> or a <mark style="color:yellow;">lower level</mark> of [scope](https://lochiwei.gitbook.io/ios/swift/scope).
{% endhint %}

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

* [global](https://lochiwei.gitbook.io/ios/swift/scope/global "mention")
  {% endtab %}
  {% endtabs %}
