Source file tour/moretypes/slice-bounds.go

     1  //go:build OMIT
     2  
     3  package main
     4  
     5  import "fmt"
     6  
     7  func main() {
     8  	s := []int{2, 3, 5, 7, 11, 13}
     9  
    10  	s = s[1:4]
    11  	fmt.Println(s)
    12  
    13  	s = s[:2]
    14  	fmt.Println(s)
    15  
    16  	s = s[1:]
    17  	fmt.Println(s)
    18  }
    19  

View as plain text