Skip to content

Instantly share code, notes, and snippets.

@jjuliano
Last active December 16, 2019 11:01
Show Gist options
  • Save jjuliano/914173e918e3fcece228802651f4024c to your computer and use it in GitHub Desktop.
Save jjuliano/914173e918e3fcece228802651f4024c to your computer and use it in GitHub Desktop.
package main
import "fmt"
func is_lengthy(length int, fruits []string) bool {
var all = make([]bool,len(fruits))
var cond bool
for i := 0; i < len(fruits); i++ {
all[i] = len(fruits[i]) > length
}
for v := range all {
if cond = all[v] == true; cond == false {
break
}
}
fmt.Println(cond)
return cond
}
func main() {
fruits := []string{"Apple", "Mango", "Orange", "Banana"}
is_lengthy(4, fruits) // true
is_lengthy(5, fruits) // false
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment