Created
October 9, 2013 01:03
-
-
Save bjhaid/6894506 to your computer and use it in GitHub Desktop.
Wednesday Kata
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Complete the method so that it formats the words into a single comma separated value. The last word should be separated by the word 'and' instead of a comma. The method takes in an array of strings and returns a single formatted string. Empty string values should be ignored. Empty arrays or null/nil values being passed into the method should result in an empty string being returned. | |
format_words(['ninja', 'samurai', 'ronin']) # should return "ninja, samurai and ronin" | |
format_words(['ninja', '', 'ronin']) # should return "ninja and ronin" | |
format_words([]) # should return "" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment