tweaks
This commit is contained in:
parent
6a0ef1145c
commit
38378a9e10
@ -14,9 +14,9 @@ func main() {
|
||||
var a [5]int
|
||||
fmt.Println("emp:", a)
|
||||
|
||||
// We can set a value at a given index using the
|
||||
// `array[index] = value` syntax, and get a value
|
||||
// with `array[index]`.
|
||||
// We can set a value at an index using the
|
||||
// `array[index] = value` syntax, and get a value with
|
||||
// `array[index]`.
|
||||
a[4] = 100
|
||||
fmt.Println("set:", a)
|
||||
fmt.Println("get:", a[4])
|
||||
|
@ -9,4 +9,4 @@ dcl: [1 2 3 4 5]
|
||||
2d: [[0 1 2] [1 2 3]]
|
||||
|
||||
# You'll see _slices_ much more often than arrays in
|
||||
# typical Go code. We'll look at slices next.
|
||||
# typical Go. We'll look at slices next.
|
||||
|
@ -1,5 +1,5 @@
|
||||
// _Slices_ are a key data type in Go, giving a more
|
||||
// powerful interface to sequences that arrays.
|
||||
// powerful interface to sequences than arrays.
|
||||
|
||||
package main
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user