Browse Source

style(printandmiss): formatting, white-space

DEV-3181-new-go-exercise-printandmiss
Tiago Collot 2 years ago
parent
commit
29cec306c1
  1. 26
      subjects/printandmiss/README.md

26
subjects/printandmiss/README.md

@ -1,22 +1,22 @@
## printandmiss # printandmiss
### Instructions ### Instructions
Write a function called `PrintAndMiss` that takes a string and an integer and return a string containing the characters until reaching the integer, then skipping that same number of characters, and repeats until the end of the string. Write a function called `PrintAndMiss()` that takes a `string` and an `int` as an argument and returns a `string` containing the characters until reaching the `int`, then skipping that same number of characters, and it repeats until the end of the `string`.
- If the string is empty return `Invalid Output` followed by newline `\n`.
- If the integer is `0` or it's negative return the string followed by a newline `\n`.
- If the `string` is empty return `Invalid Output` followed by newline `\n`.
- If the `int` is `0` or it's negative return the `string` followed by a newline `\n`.
### Expected function ### Expected function
```go ```go
func PrintAndMiss(arg string, num int) string { func PrintAndMiss(arg string, num int) string {
} }
``` ```
### 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
@ -24,16 +24,16 @@ package main
import "fmt" import "fmt"
func main() { func main() {
fmt.Print(PrintAndMiss("123456789", 3)) fmt.Print(PrintAndMiss("123456789", 3))
fmt.Print(PrintAndMiss("abcdefghijklmnopqrstuvwyz", 3)) fmt.Print(PrintAndMiss("abcdefghijklmnopqrstuvwyz", 3))
fmt.Print(PrintAndMiss("", 3)) fmt.Print(PrintAndMiss("", 3))
fmt.Print(PrintAndMiss("hello you all ! ", 0)) fmt.Print(PrintAndMiss("hello you all ! ", 0))
fmt.Print(PrintAndMiss("what is your name?", 0)) fmt.Print(PrintAndMiss("what is your name?", 0))
fmt.Print(PrintAndMiss("go Exercise Print and Miss", -5)) fmt.Print(PrintAndMiss("go Exercise Print and Miss", -5))
} }
``` ```
And its output : And its output:
```go ```go
$ go run . | cat -e $ go run . | cat -e

Loading…
Cancel
Save