Skip to content

Instantly share code, notes, and snippets.

@c9s
Created December 1, 2013 09:13
Show Gist options
  • Save c9s/7730260 to your computer and use it in GitHub Desktop.
Save c9s/7730260 to your computer and use it in GitHub Desktop.
package main
import "fmt"
func main() {
items := []int{1, 2, 3, 4}
items = append(items, 5, 6)
newItems := items[3:]
subItems := items[:]
fmt.Printf("items %+v\n", items)
fmt.Printf("newItems %+v\n", newItems)
fmt.Printf("subItems %+v\n", subItems)
fmt.Printf("length %d\n", len(subItems))
for i, val := range items {
fmt.Printf("items[%d] = %d\n", i, val)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment