Section10-82

This commit is contained in:
2023-11-09 14:14:28 +01:00
parent 40b6e50a16
commit f0c2e76a4f
2 changed files with 44 additions and 0 deletions

22
Section10/82.go Normal file
View 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)
}