# Arrays

The type `[n]T` is an array of `n` values of type `T`.

### Declaration

```go
var a [10]int    // a variable `a` as an array of 10 integers
```

{% hint style="info" %}
An array's length is part of its type, so arrays can't be resized. Don't worry about this limitation for now. There is a convenient way later.
{% endhint %}

### Example

```go
package main

import "fmt"

func main() {
    var a [2]string
    a[0] = "Oliver"
    a[1] = "Chen"
    fmt.Println(a[0], a[1])
    fmt.Println(a)
    
    numbers := [7]int{1, 2, 3, 4, 5, 6, 7}
    fmt.Println(numbers)
}
```

```bash
Oliver Chen
[Oliver Chen]
[1 2 3 4 5 6 7]
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://blog.yushunchen.com/golang-notes/official-tutorial-notes/more-types/arrays.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
