Compare commits

...

9 Commits

Author SHA1 Message Date
Hamza elkhatri 61e2eb5ce4
add condition 2 years ago
hamza edeab949b6 fix:typo 2 years ago
hamza e507963971 fix:rename the folder 2 years ago
Hamza elkhatri 1e184a2ca1
Update README.md 2 years ago
Hamza elkhatri 567772afa9
Update README.md 2 years ago
Hamza elkhatri f6826b23fc
Update README.md 2 years ago
Hamza elkhatri 2463ea4a73
Update README.md 2 years ago
hamza 29fb4cbda8 fix(subject):rename the subject 2 years ago
hamza aa0d6ec508 subject(skip-the-line):add readme 2 years ago
  1. 39
      subjects/addfront/README.md

39
subjects/addfront/README.md

@ -0,0 +1,39 @@
## addfront
### Instructions
Write a function that takes a string and a slice of strings, this function will return a new slice of string with the given string prepended
- If the given string is empty you only need to return the given slice
### Expected function
```go
func AddFront(s string, slice []string) []string {
// your code here
}
```
### Usage
Here is a possible program to test your function:
```go
package main
import "fmt"
func main() {
fmt.Println(AddFront("Hello", []string{"world"}))
fmt.Println(AddFront("Hello", []string{"world", "!"}))
fmt.Println(AddFront("Hello", []string{}))
}
```
and the output should be:
```console
$ go run .
[Hello world]
[Hello world !]
[Hello]
```
Loading…
Cancel
Save