Browse Source

docs(sliceRemove): fix subject

- fixed incorrect output
- fix grammar
- fix identation
DEV-4017-prototypes-exercise-1-animals
jotapero 2 years ago committed by José Rosendo
parent
commit
0fe2165844
  1. 18
      subjects/sliceremove/README.md

18
subjects/sliceremove/README.md

@ -2,8 +2,8 @@
### Instructions ### Instructions
- Write a function that takes a slice of integers and int and removes any number in the slice that is equal to the int then returns the slice Write a function that takes a slice of integers and an `int` as arguments, if the given `int` exists in the slice then remove it, otherwise return the slice.
- If the slice is empty, return the slice itself - If the slice is empty, return the slice itself.
### Expected function ### Expected function
@ -15,25 +15,27 @@ func SliceRemove(slice []int , num int) []int {
### Usage ### Usage
Here is a possible program to test your function : Here is a possible program to test your function:
```go ```go
package main package main
import ( import (
"fmt" "fmt"
"piscine"
) )
func main() { func main() {
fmt.Println(SliceRemove([]int{1, 2, 3},2)) fmt.Println(piscine.SliceRemove([]int{1, 2, 3}, 2))
fmt.Println(SliceRemove([]int{4,3}, 4)) fmt.Println(piscine.SliceRemove([]int{4, 3}, 4))
} }
``` ```
And its output : And its output:
```console ```console
$ go run . $ go run .
[1 3 4] [1 3]
[4] [3]
``` ```

Loading…
Cancel
Save