Section8-72
This commit is contained in:
37
Section8/72.go
Normal file
37
Section8/72.go
Normal file
@@ -0,0 +1,37 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"strings"
|
||||
)
|
||||
|
||||
func main() {
|
||||
numbers := [3]int{10, 20, 30}
|
||||
fmt.Printf("%#v\n", numbers)
|
||||
|
||||
numbers[0] = 7
|
||||
fmt.Printf("%#v\n", numbers)
|
||||
|
||||
for i, v := range numbers {
|
||||
fmt.Println("index:", i, " value:", v)
|
||||
}
|
||||
|
||||
fmt.Println(strings.Repeat("#", 20))
|
||||
for i := 0; i < len(numbers); i++ {
|
||||
fmt.Println("index:", i, " value:", numbers[i])
|
||||
}
|
||||
|
||||
balances := [2][3]int{
|
||||
{5, 6, 7},
|
||||
[3]int{8, 9, 10},
|
||||
}
|
||||
fmt.Println(balances)
|
||||
|
||||
m := [3]int{1, 2, 3}
|
||||
n := m
|
||||
|
||||
fmt.Println("n is equal to m:", n == m)
|
||||
|
||||
m[0] = -1
|
||||
fmt.Println("n is equal to m:", n == m)
|
||||
}
|
||||
Reference in New Issue
Block a user