diff --git a/examples/arrays/arrays.go b/examples/arrays/arrays.go index 0a50741a9..268b1f98b 100644 --- a/examples/arrays/arrays.go +++ b/examples/arrays/arrays.go @@ -36,6 +36,11 @@ func main() { b = [...]int{1, 2, 3, 4, 5} fmt.Println("dcl:", b) + // If you specify the index with `:`, the elements in + // between will be zeroed. + b := [...]int{100, 3: 400, 500} + fmt.Println(b) + // Array types are one-dimensional, but you can // compose types to build multi-dimensional data // structures. diff --git a/examples/arrays/arrays.sh b/examples/arrays/arrays.sh index 537a5cca5..2330f1116 100644 --- a/examples/arrays/arrays.sh +++ b/examples/arrays/arrays.sh @@ -7,4 +7,5 @@ get: 100 len: 5 dcl: [1 2 3 4 5] dcl: [1 2 3 4 5] +idx: [100 0 0 400 500] 2d: [[0 1 2] [1 2 3]]