Add notes on square brackets syntax

This commit is contained in:
Tiago Cunha 2024-06-23 23:15:17 -03:00
parent d6ea0010c3
commit 8127865012
2 changed files with 2 additions and 0 deletions

View File

@ -374,6 +374,7 @@ type Map:
``` ```
Notice that the getter and setter syntax induces an order on things using the map, since every get or set operation depends on the value of the previous map. Notice that the getter and setter syntax induces an order on things using the map, since every get or set operation depends on the value of the previous map.
> **_NOTE:_** Do not get mistaken with lists creation syntax, that also uses `[` `]`.
### Mixing syntaxes ### Mixing syntaxes

View File

@ -234,6 +234,7 @@ def main:
``` ```
Will return `1`, which is the first element. Will return `1`, which is the first element.
> **_NOTE:_** Despite creating lists with `[` `]`, the syntax used for accessing values as in `type[key]` is actually related to the `Map` built-in type.
We also have a syntax sugar for strings in Bend, which is just a list of `u24` We also have a syntax sugar for strings in Bend, which is just a list of `u24`
characters (UTF-16 encoded). The `"Hello, world!"` type we've seen used it! characters (UTF-16 encoded). The `"Hello, world!"` type we've seen used it!