-
Notifications
You must be signed in to change notification settings - Fork 3
/
main.go
45 lines (37 loc) · 858 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package main
import "fmt"
func main() {
cars := make([]string, 0, 2)
cars = append(cars, "a")
fmt.Println(cars)
cars = append(cars, "b")
fmt.Println(cars)
cars = append(cars, "c")
fmt.Println(cars)
cars = append(cars, "d")
fmt.Println(cars)
foods := (make([]string, 2))
foods[1] = "apple"
fmt.Println(foods)
// var person []string
// person[10] = "lucy"
// fmt.Println(len(person))
// rooms := make([]int, 0, 2)
// things := []int{0, 1, 2, 3}
// for _, thing := range things {
// fmt.Println("place thing", thing)
// rooms = append(rooms, thing)
// }
// fmt.Println("rooms", rooms)
// box := []int{}
// items := []int{0, 1, 2, 3}
// for index, item := range items {
// if index > 2 {
// break
// }
// box = append(box, item)
// }
// fmt.Println("box", box)
numbers := []int{1}
fmt.Println("numbers: ", numbers[1:])
}