Last active
December 16, 2019 11:01
-
-
Save jjuliano/914173e918e3fcece228802651f4024c 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 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