Array သည် size fixed ဖြစ်တဲ့ collection ပါ။ တူညီတဲ့ type ရှိတဲ့ value တွေကို index နဲ့သိမ်းပါတယ်။ Go မှာ array size က type ရဲ့အစိတ်အပိုင်းဖြစ်လို့ [3]int နဲ့ [4]int က မတူတဲ့ type တွေပါ။
go
package main
import "fmt"
func main() {
scores := [3]int{80, 90, 100}
fmt.Println(scores)
fmt.Println("first score:", scores[0])
fmt.Println("total items:", len(scores))
}scores[0] က ပထမဆုံး item ကိုယူတာပါ။ Programming မှာ index အများစုက 0 ကစတာကြောင့် ပထမ item သည် index 0 ဖြစ်ပါတယ်။
You should see
[80 90 100] first score: 80 total items: 3Info
Array က fixed size ဖြစ်လို့ data အရေအတွက်ပြောင်းနိုင်တဲ့ real project တွေမှာ slice ကိုပိုသုံးကြပါတယ်။