Experiment boldly: Here are some suggestions. You might try other experiments, too.
The goal now is to build plural
, a reporter block that takes a noun as input and outputs the plural of the noun, spelled correctly.
plural
block.
Here's one way to start building that block.
plural
does not work correctly. List the words you find. Organize that list, sorting the words into categories according to their last letter. For example, it will get wrong some words that end with the letter h. Try to find many words it gets wrong. Debugging: To write good code that works, you want to try to "break" it, to find situations in which it does not work. This requires thinking of wild and exceptional cases, even including inputs that are incorrect in some way, like this example, which has a space at the end.
plural
should now work correctly for "day" and "boss" and "medicine," but it probably doesn't yet work correctly for the word "box"
.
Edit your plural
block to make it work for words that end with x. Test it to make sure it does work properly.
map
to test all the words on your list.
For now, don't worry about the words it still gets wrong, as long as it still works for "day," "boss," "medicine," "box."
You may find these useful in your tests.