> For the complete documentation index, see [llms.txt](https://aup.nomi.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://aup.nomi.dev/the-language/collections/array.md).

# Array

## Syntax

To create an array, just use the pair of square brackets `[]`

```javascript
var nums = [1, 2, 3]
puts nums
```

### Index

Like other languages, accessing array member via index.

```javascript
var arr = [4, 5]
puts arr[0]
```

{% hint style="info" %}
Notice, index of array start at 0.
{% endhint %}

{% hint style="info" %}
Index out of ranges or not a number, we got null.
{% endhint %}

### Assignment

## Examples

Cached recursive fibonacci

```go
var cache = [0, 1, 1]

func fib(n) {
    if n < 2 return n
    if cache[n] return cache[n]
    return cache[n] = fib(n - 2) + fib(n - 1)
}

puts fib(40)
```
