|
|
|
## piglatin
|
|
|
|
|
|
|
|
### Instructions
|
|
|
|
|
|
|
|
Write a **program** that transforms a string passed as argument in its `Pig Latin` version.
|
|
|
|
|
|
|
|
The rules used by Pig Latin are as follows:
|
|
|
|
|
|
|
|
- If a word begins with a vowel, just add "ay" to the end.
|
|
|
|
- If it begins with a consonant, then we take all consonants before the first vowel and we put them on the end of the word and add "ay" at the end.
|
|
|
|
|
|
|
|
If the word has no vowels, the program should print "No vowels".
|
|
|
|
|
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
|
|
|
If the number of arguments is different from one, the program prints nothing.
|
|
|
|
|
|
|
|
### Usage
|
|
|
|
|
|
|
|
```console
|
|
|
|
$ go run .
|
|
|
|
$ go run . pig | cat -e
|
|
|
|
igpay$
|
|
|
|
$ go run . Is | cat -e
|
|
|
|
Isay$
|
|
|
|
$ go run . crunch | cat -e
|
|
|
|
unchcray$
|
|
|
|
$ go run . crnch | cat -e
|
|
|
|
No vowels$
|
|
|
|
$ go run . something else | cat -e
|
|
|
|
$
|
|
|
|
```
|