Browse Source

docs(sliceAdd): fix subject

- fix indentation
- fix grammar
- fix packages and import
pull/1526/head
jotapero 2 years ago committed by José Rosendo
parent
commit
44e4eb1dfe
  1. 14
      subjects/sliceadd/README.md

14
subjects/sliceadd/README.md

@ -2,8 +2,8 @@
### Instructions
- Write a function that takes a slice of integers and int and adds integer in the slice then returns the slice
- If the slice is empty, return a slice with the new value
Write a function that takes a slice of integers and an `int` as arguments, adds the `int` to the slice and returns it.
- If the slice is empty, return a slice with the new value.
### Expected function
@ -15,22 +15,24 @@ func SliceAdd(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(SliceAdd([]int{1, 2, 3}, 4))
fmt.Println(SliceAdd([]int{}, 4))
fmt.Println(piscine.SliceAdd([]int{1, 2, 3}, 4))
fmt.Println(piscine.SliceAdd([]int{}, 4))
}
```
And its output :
And its output:
```console
$ go run .

Loading…
Cancel
Save