Section10-Finished

This commit is contained in:
2023-11-15 14:18:47 +01:00
parent f0c2e76a4f
commit 110aab4934
2 changed files with 86 additions and 0 deletions

32
Section10/87.go Normal file
View File

@@ -0,0 +1,32 @@
package main
import "fmt"
func main() {
var nums []int
fmt.Printf("%#v\n", nums)
fmt.Printf("Lenght: %d, Capacity: %d \n", len(nums), cap(nums))
nums = append(nums, 1, 2)
fmt.Printf("Lenght: %d, Capacity: %d \n", len(nums), cap(nums))
nums = append(nums, 3)
fmt.Printf("Lenght: %d, Capacity: %d \n", len(nums), cap(nums))
nums = append(nums, 4)
fmt.Printf("Lenght: %d, Capacity: %d \n", len(nums), cap(nums))
nums = append(nums, 5)
fmt.Printf("Lenght: %d, Capacity: %d \n", len(nums), cap(nums))
nums = append(nums[0:4], 200, 300, 400, 500, 600)
fmt.Printf("Lenght: %d, Capacity: %d \n", len(nums), cap(nums))
fmt.Println(nums)
letters := []string{"A", "B", "C", "D", "E", "F"}
letters = append(letters[:1], "X", "Y")
fmt.Println(letters, len(letters), cap(letters))
fmt.Println(letters[3:6])
}