Created
June 3, 2017 04:06
-
-
Save swshan/dc377d80bbb57d76aa5ed2fc46a4101d to your computer and use it in GitHub Desktop.
This file contains hidden or 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
// 来自 http://xinqiu.me/2017/05/09/a-byte-of-go/ 的练习代码 | |
package main | |
import "fmt" | |
func main() { | |
s := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9} | |
a := s[3:6] | |
b := a[1:2] | |
printSlice(a) | |
printSlice(b) | |
} | |
func printSlice(s []int) { | |
fmt.Printf("len=%d cap=%d %v\n", len(s), cap(s), s) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment