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.
Probably not.
One best practice vote.
Is it really best practice to use exceptions to manage control flow?
This comment is hidden because it contains spoiler information about the solution
Can it pass the test such as solution(["a","b","c"],3,"a")? I think it should return a
Does this qualify as "easily?"
signmod = index < 0 ? 1 : 0
(index.abs() < items.length + signmod ) ? items[index] : default_value
@wchargin, I think it's fine to use the ternary ? operator here. Is that what you meant by this isn't very Ruby?
See http://stackoverflow.com/questions/4252936/how-do-i-use-the-conditional-operator-in-ruby
This isn't very Ruby. (1) you should use the builtin
fetch
, (2) if not, you should useunless
statements instead.