A Quick Peek at Ruby: Rotating an Array
Sunday November 16, 2008
Rotating an array in Ruby is as simple as combining two existing methods: shift and push. As you may know, the shift method provides for taking an object from the front of an array and the push mehtod provides for adding an object to the back. It just makes sense that combining the two would allow you to rotate your array, as our sample code shows you.
More Ruby FAQs:

Comments
No comments yet. Leave a Comment