package main
import (
"fmt"
)
func main() {
// Declare arrays
var x[5] int
//Assign value at specific index
x[0] = 5
x[4] = 25
fmt.Println("Value of x:",x)
x[1] = 10
x[2] =15
x[3] = 20
fmt.Println("Value of x:",x)
//Declare and initialize array with array literal
y := [5] int{10,20,30,40}
fmt.Println("Value of y",y)
//Array literal with ...
z := [...] int {10,20,30,40,50}
fmt.Println("Value of z",z)
fmt.Println("Length of z:",len(z))
//Initialize values at specific index with array literal
langs :=[4]string{0:"Go",3:"Julia"}
fmt.Println("Value of langs",langs)
// Assign values to remaining postion
langs[1] = "Rust"
langs[2] = "Scala"
// Iterate over the elements of array
fmt.Println("Value of langs",langs)
println("
Itearator over aarays
")
for i:=0;i<len(langs);i++{
fmt.Printf("langs[%d]:%s
",i,langs[i])
}
//Iterator over the elements of array using range
for k,v:=range langs{
println(k,v)
}
}