Learning Ruby: Recursion

One of my fellow Berkterns is teaching some of us Ruby this summer. Our first lesson included an example in which we define an array, set a variable equal to that array, and then added that variable into the array, effectively defining an infinite array (one that, in our case, repeated “dog, pony, show” over and over again).

“This is recursion,” our wise teacher announced. “If you don’t know what recursion is, Google it.”

We all dutifully followed his instructions and found this:

Recursion.  Did you mean recursion?

Oh, Google.

4 thoughts on “Learning Ruby: Recursion”

Leave a Reply to The 27th Comrade Cancel reply

Your email address will not be published. Required fields are marked *