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.
name is a String object.
String class has the [] instance method that let you
extract parts of the String object.
In this case name[0] returnes the first character of name
name[1..-1] will give back a new string without the first character
https://ruby-doc.org/core-2.7.2/String.html#method-i-5B-5D
Why name with an array and 0 ? name[0]
Im curious as to why we do not need to specify return "false" or "true" in this example?
Math is allowed, what you are getting is:
"Math::DomainError (Numerical argument is out of domain - "sqrt")"
you could use 'raise' to attend it or use logical expression to ensure the positive range of the number before use Math::sqrt
This comment is hidden because it contains spoiler information about the solution
Thanks for mentioning. I am new on this platform and didn't know the purpose of spoiler flag. Now I knnow. Thanks :)
Use spoiler flag, please.
This comment is hidden because it contains spoiler information about the solution
You get this error when you pass a negative value to Math.sqrt. You can't pass negative to it.
Hi prince1456,
How did you get it solved with javascript? I've been getting 47 for 0112 with number reverse, string split reverse conversion, and even with iteration using for loop. What do you suggest is the reason for this?
Thanks
i agree, for example 1e16+1 returns true when it shouldn't
hmm.. i kept getting sqrt error. not sure why. thought Math.sqrt isn't supported here.
I have same problem and im stuck on this but i solved it with javascript lol but ruby oh nooooo
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Loading more items...