Instantly share code, notes, and snippets.
The if codeblocks is something I would do in C, but in a single line. Another was the input variable. In C, it's not easy to setup a memory type that can handle both integers and strings (there are tricks, but it's not pretty.) But in general, this is similar to the way I would solve the problem in C. This is nice because Ruby can handle a coding style which is similar to C.