You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

50 lines
867 B

5 years ago
## any
5 years ago
### Instructions
5 years ago
Écrire une fonction `Any` qui retourne `true`, pour un tableau de `string` :
5 years ago
- si, lorsque ce tableau de `string` est passé à travers une fonction `f`, au moins un element retourne `true`.
5 years ago
### Fonction attendue
```go
func Any(f func(string) bool, arr []string) bool {
5 years ago
}
```
5 years ago
### Utilisation
Voici un éventuel [programme](TODO-LINK) pour tester votre fonction :
```go
package main
import (
"fmt"
piscine ".."
)
func main() {
tab1 := []string{"Hello", "how", "are", "you"}
tab2 := []string{"This", "is", "4", "you"}
result1 := piscine.Any(piscine.IsNumeric, tab1)
result2 := piscine.Any(piscine.IsNumeric, tab2)
fmt.Println(result1)
fmt.Println(result2)
}
```
Et son résultat :
```console
student@ubuntu:~/[[ROOT]]/test$ go build
student@ubuntu:~/[[ROOT]]/test$ ./test
false
true
student@ubuntu:~/[[ROOT]]/test$
```