Knaph

Arrays

Arrays: fixed size, rarely used directly

var scores [3]int
scores[0] = 90
scores[1] = 85
scores[2] = 78

An array's length is part of its type — [3]int and [5]int are different types, not just different lengths of the same type. That's rigid enough that you'll rarely declare a bare array in everyday Go. What you'll actually use, constantly, is a slice — next lesson.

Sign in to track your progress through this course.

Ask an AI

Open a ready-made prompt in ChatGPT or Claude — just press Enter.

SummarizeChatGPTClaude
Ask me questionsChatGPTClaude
Let's learn togetherChatGPTClaude