Browse Source

docs(sliceAdd): fix subject

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

Loading…
Cancel
Save