Browse Source

docs(sliceRemove): fix subject

- fixed incorrect output
- fix grammar
- fix identation
pull/1526/head
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
- 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
- If the slice is empty, return the slice itself
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.
### Expected function
@ -15,25 +15,27 @@ func SliceRemove(slice []int , num int) []int {
### Usage
Here is a possible program to test your function :
Here is a possible program to test your function:
```go
package main
import (
"fmt"
"piscine"
)
func main() {
fmt.Println(SliceRemove([]int{1, 2, 3},2))
fmt.Println(SliceRemove([]int{4,3}, 4))
fmt.Println(piscine.SliceRemove([]int{1, 2, 3}, 2))
fmt.Println(piscine.SliceRemove([]int{4, 3}, 4))
}
```
And its output :
And its output:
```console
$ go run .
[1 3 4]
[4]
[1 3]
[3]
```

Loading…
Cancel
Save