Files
learning-go-jon-bodner/chapter-3-composite-types/02_slices.go
2022-12-03 23:07:58 +00:00

17 lines
301 B
Go

// the length is not part of the type for a slice
// slices use the same syntax as arrays for accessing/assigning
package main
import "fmt"
func main() {
// []int makes a slice, [...]int makes an array
x := []int{10, 20, 30}
fmt.Println(x)
x = []int{1, 5: 4, 6, 10: 20, 11}
fmt.Println(x)
}