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.
I solved it the same way :)
do you have a right example how to solve it with closures?
Wrong solution - no closure used. Yes this solution works, but the task was to use closure.
No, it's not.
Is this really using the concept of closures though?
I forgot all about the scope..
Living up to your name eh OverZealous?
The description says the function takes in "a non-negative integer". So it doesn't need to handle strings. Even if it did I generally don't use the fuzzy boolean checks. I was just hammering through some of the kata's I missed.
Won't that have inconsistent behavior? You're using absolute equality in the first comparison but not in the second comparison (=== and <=). If someone passes a string "1" they'll get 5, but if they pass "0" they'll get 5 too. === should be changed to ==.
Funny that a lot of people seem not to have bothered removing the TODO comment, haha.