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.
If the parameter is omitted, the default value should be an empty string. Your code is returning nil because the parameter doesn't exist and you are using str even though it doesn't exist.
It's a suggestion not an issue.
That is the splat operator - in this context - used for array coercion. You delve deeper here: https://endofline.wordpress.com/2011/01/21/the-strange-ruby-splat/
This comment is hidden because it contains spoiler information about the solution
Current Ruby translations has 8 example test cases, which is not that few for a kata.
Would be better to show more examples
This comment is hidden because it contains spoiler information about the solution
Try to
puts
the original input and see some example; I fear your code might have some counting problem; on a side note, you would only need to use.to_f
once, if you want a small bit of extra optimization.This comment is hidden because it contains spoiler information about the solution
The method has a different name in the first test buyOrPass instead of buy_or_pass
Anyone know why this doesn't work? I get the error message bad value for range but when I try it in irb it works:
def summation(x)
a = [*1..x]
b = a.inject(0, &:+)
if x.is_a?(Integer)
return b
else
"Invalid Value"
end
end
This comment is hidden because it contains spoiler information about the solution
State that input will be floats or integers as well as postive or negative
I think you've made just a little mistake and there's a bug in ruby's example test cases. Just rename the method in this example test case or only use the final tests.
In Ruby's example test cases the method's name is spelled wrong. It's called
buyOrPass
but in the kata's setup is calledbuy_or_pass
.Loading more items...