1. Home
  2. Computing & Technology
  3. Ruby
photo of Amanda & Michael Morin
Amanda and Michael's Ruby Blog

By Amanda & Michael Morin, About.com Guides to Ruby

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

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

Discuss
Community Forum
Explore Ruby
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. Ruby

©2009 About.com, a part of The New York Times Company.

All rights reserved.