mirror of https://github.com/01-edu/public.git
estlop
2 years ago
1 changed files with 34 additions and 0 deletions
@ -0,0 +1,34 @@ |
|||||||
|
## evenlength |
||||||
|
|
||||||
|
### Instructions |
||||||
|
|
||||||
|
Write a function that receives a slice of strings and returns a new slice with the strings in which the length is even. |
||||||
|
|
||||||
|
### Expected function |
||||||
|
|
||||||
|
```go |
||||||
|
func EvenLength(strings []string) []string { |
||||||
|
} |
||||||
|
``` |
||||||
|
|
||||||
|
### Usage |
||||||
|
|
||||||
|
Here is a possible program to test your function: |
||||||
|
|
||||||
|
```go |
||||||
|
package main |
||||||
|
import ( |
||||||
|
"fmt" |
||||||
|
) |
||||||
|
func main() { |
||||||
|
l := EvenLength([]string{"Hi", "Hola", "Ola", "Ciao", "Salut", "Hallo"}) |
||||||
|
fmt.Println(l) |
||||||
|
} |
||||||
|
``` |
||||||
|
|
||||||
|
And its output: |
||||||
|
|
||||||
|
```console |
||||||
|
$ go run . |
||||||
|
[Hi Hola Ciao] |
||||||
|
``` |
Loading…
Reference in new issue