Skip to content

Instantly share code, notes, and snippets.

@kn9ts
Forked from anonymous/untitled
Created July 16, 2015 06:57
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kn9ts/3b9833758283993264b0 to your computer and use it in GitHub Desktop.
Save kn9ts/3b9833758283993264b0 to your computer and use it in GitHub Desktop.
// Function to check if the the string given is in the array
inArray := func(str string, list []string) bool {
for _, v := range list {
if v == str {
return true
}
}
return false
}
@prasad83
Copy link

prasad83 commented Jan 3, 2021

nil check on list can make this function safe - see

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment