Skip to content

x/website: Add an example for arrays with the [...]T{a, b, c, d} syntax #66851

@adriancuadrado

Description

@adriancuadrado

What is the URL of the page with the issue?

https://go.dev/tour/moretypes/6

What is your user agent?

Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36

Screenshot

image

What did you do?

I read this article and found this code snippet:

b := [...]string{"Penn", "Teller"}

What did you see happen?

It is equivalent to this:

b := [2]string{"Penn", "Teller"}

but it's more convenient because you don't have to count the number of elements since that is done automatically for you by the compiler.

What did you expect to see?

I think it would be awesome to include this feature in A Tour of Go. More specifically here.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions