Go slice

package main

import "fmt"

func main() {
    var a = [6]int{1, 2, 3, 4, 5, 6}

    var b = a[2:4]

    fmt.Print(b)
}

Outputs:

[3 4]

你可能感兴趣的:(Go slice)