Section10-82
This commit is contained in:
22
Section10/82.go
Normal file
22
Section10/82.go
Normal file
@@ -0,0 +1,22 @@
|
||||
package main
|
||||
|
||||
import "fmt"
|
||||
|
||||
func main() {
|
||||
a := [5]int{1, 2, 3, 4, 5}
|
||||
b := a[1:3]
|
||||
fmt.Printf("%v, %T\n", b, b)
|
||||
|
||||
s1 := []int{1, 2, 3, 4, 5, 6}
|
||||
s2 := s1[1:3]
|
||||
fmt.Println(s2)
|
||||
fmt.Println(s1[2:])
|
||||
fmt.Println(s1[:3])
|
||||
fmt.Println(s1[:])
|
||||
|
||||
s1 = append(s1[:4], 100)
|
||||
fmt.Println(s1)
|
||||
|
||||
s1 = append(s1[:4], 200)
|
||||
fmt.Println(s1)
|
||||
}
|
||||
Reference in New Issue
Block a user