Skip to content

Instantly share code, notes, and snippets.

@rvantonder
Created April 2, 2019 18:57
Show Gist options
  • Save rvantonder/054199947b6621ba7ae6a5b31e51d023 to your computer and use it in GitHub Desktop.
Save rvantonder/054199947b6621ba7ae6a5b31e51d023 to your computer and use it in GitHub Desktop.
package main
import "fmt"
func check_slice(x []int) {
if x != nil && len(x) != 0 {
fmt.Println(len(x))
}
}
func main() {
var s []int
a := [5]int{1, 2, 3, 4, 5}
s = a[2:4]
check_slice(s)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment