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.
WTF? How does that even work?
Gz on the clean solution, btw
hehehe. noice.
Thank you!
So it is an inline conditional... here is an article explaining it better than I could.. :)
https://www.natashatherobot.com/ruby-shorthands-if-then-else/
I'm a total noob at this. Would someone please tell me how this works? I've tried googling colon and questionmark, but I haven't found a satisfactory explanation.
I knew something like this was possible and just couldn't sort it out. Thank you!
Ruby lets you specify default values for a method's arguments---values that will be used if the caller doesn't pass them explicitly. This is done using the assignment operator
=
.because name of method is 'always'
Beautiful!
could somebody explain to me why did the author assign n to nil when he passed it to the method always?
This solution just creates a variable
SafeInteger
equal to the inbuilt function Number.isSafeInteger which has the same utility as that required by the kata.The function
Number.isSafeInteger()
itself is assigned to thevar SafeInteger
and so SafeInteger inherits the properties of isSafeInteger. Basically, SafeInteger is an alias to Number.isSafeInteger.I don't really understand this answer.
Any chance someone could explain this to me?
Very nice
I like this one because recursion. Also cause we did that same thing :P
Loading more items...