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.
Does not work properly when a negative number is given
You could also do (0...number) instead of (1...number)
Interesting! I was not aware of the range syntax with 3 dots, where 1...n exludes the end of the range.
that validation was brilliant!
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
O my love. So beautiful
short and pithy,easy to read
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
https://github.com/bbatsov/ruby-style-guide#sprintf
http://ruby-doc.org/core-2.3.0/Kernel.html#method-i-format
This comment is hidden because it contains spoiler information about the solution
The satisfaction when you submit code that resembles the best ranked solution. \m/
THank you! But what do you call this sort of operation? - "%.2X%.2X%.2X" % [arr]- I'm looking for a key term to google so I can learn more about how to use this tool, and how it works. Is it shorthand for something else?
This is how it's broken down:
First, look at the two BIG pieces: "String Format" % what_to_format (takes array as input)
So, left side is saying, "format as hexidecimal", right side is saying...
"take r,g,b array, and "map" it. What map does is take each element, and transform it somehow. How? you tell it how in the function that you pass it. The function he's passing is taking the r,g,b numbers and ensuring that they are between 0 and 255. if they're not, it forces them into that range.
So in the end it looks something like this "%.2X%.2X%.2X" % [27,255,133] (or whatever rgb values it is)
Loading more items...