Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Why did I force myself to write a ten-branch if/else statement... :/
No, the computer will exit the function after it executes one of the return statements, so there is no danger that it will try to return multiple values.
Great, I think that really makes the use of "index" in this context clear. Good kata overall.
My mistake, thanks for the clarification.
Instead of
.chars.each
,.each_char
is also possible.This comment is hidden because it contains spoiler information about the solution
The kata says that even-indexed chars should be capitalized and odd-indexed chars, lowercased, but does not accept "ThIs iS A TeSt", even though the string satisfies both rules. Some users have observed that the "index" does not count spaces, but the term is never used this way in computer science, and no one would assume not to count spaces. If it is really the case that whitespace is not to be observed in the calculation of the "index", this should be specified in the kata.