Created
April 2, 2019 18:57
-
-
Save rvantonder/054199947b6621ba7ae6a5b31e51d023 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
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