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.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
Read this: https://docs.codewars.com/training/troubleshooting#post-discourse
About your question: returning inside your loop like that does exactly that, your loop only runs once until return exits the function.
Not a kata issue. Please read this: https://docs.codewars.com/training/troubleshooting/
This comment is hidden because it contains spoiler information about the solution
Oh yeah, you are right about that. ^^;
It will return
false
for anything but0
.Except with 0.
number == (-number)
will always returnfalse
.Your problem is right in the description:
But maybe the number is already negative?
Check the length of the string before trying to access something.