26 lines
505 B
Go
26 lines
505 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"reflect"
|
|
)
|
|
|
|
func main() {
|
|
|
|
fmt.Println("var VAR_NAME [SIZE] DATA_TYPE")
|
|
fmt.Println("blank indexes are 0 for numerics and empty string for strings")
|
|
|
|
var a [3]string
|
|
a[0] = "zero"
|
|
a[1] = "one"
|
|
fmt.Println(a[0], a[1])
|
|
fmt.Println(a)
|
|
|
|
fmt.Println("You can also declare a variable as an array like this")
|
|
negative := [10]int{1, 2}
|
|
|
|
fmt.Println(negative)
|
|
fmt.Println(reflect.TypeOf(negative))
|
|
|
|
fmt.Println("Array cannot be resized!!! Instead slices can be used")
|
|
}
|