Skip to content

Instantly share code, notes, and snippets.

@lleo
Last active February 8, 2016 00:27
Show Gist options
  • Save lleo/f1945d6be1cc3cabdf55 to your computer and use it in GitHub Desktop.
Save lleo/f1945d6be1cc3cabdf55 to your computer and use it in GitHub Desktop.
slice limit & args array
package main
import "fmt"
func showArgs(args ...int) {
fmt.Println(args)
}
func main() {
//n := []byte{0, 1, 2, 3, 4} //odd
n := []byte{0, 1, 2, 3} //even
l := n[:len(n)/2]
r := n[len(n)/2:]
fmt.Println(n)
fmt.Println(len(n)/2)
fmt.Println(l)
fmt.Println(r)
showArgs(1,2,3)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment