Created
December 1, 2013 09:13
-
-
Save c9s/7730260 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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