|
|
|
## displayz
|
|
|
|
|
|
|
|
### Instructions
|
|
|
|
|
Refactor & Beautify & destruction commit
return early, remove else branches, reorder conditions and top-level functions, remove empty lines, remove unnecessary append(), fix typos, stop using testing package, remove dead code, fix mistakes in subjects, tests and solutions, remove disclaimers, reformat comments, simplify solutions, tests, add more instructions to subjects, remove obsolete files, etc.
Some of the reasons behind those modifications will be added to good-practices.en.md
Some of the exercises are now broken, they will have to be fixed, most of them have a "TODO:" comment.
5 years ago
|
|
|
Write a program that takes a `string`, and displays the first `z` character it encounters in it, followed by a newline (`'\n'`).
|
|
|
|
If there are no `z` characters in the string, the program just writes `z` followed by a newline (`'\n'`).
|
|
|
|
If the number of arguments is not 1, the program displays an `z` followed by a newline (`'\n'`).
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
|
|
|
|
```console
|
|
|
|
$ go run . "xyz"
|
|
|
|
z
|
|
|
|
$ go run . "bcvbvZ"
|
|
|
|
z
|
|
|
|
$ go run . "nbv"
|
|
|
|
z
|
|
|
|
$ go run .
|
|
|
|
```
|