For various reasons I've taken it upon myself to learn Ruby and I thought I would share a humdinger. Implementing functions checking for odd-ness and even-ness is often held as an example for illustrating mutual function recursion, and the same can be illustrated with Ruby: def e?(n) if n.zero? true else o?(n.abs - 1) end [...]
Published on February 25, 2011 10:31