Changes

Jump to: navigation, search

Understanding Ruby Arrays

6 bytes removed, 20:22, 26 November 2007
no edit summary
In [[Understanding Ruby Variables]] we looked at storing data (such as numbers, strings and boolean true or false values) in memory locations known as variables. The variable types covered in those chapters were useful for storing one value per variable. Often, however, it is necessary to group together multiple variables into a self contained object. This is where the concept of Ruby Arrays comes in. The objective of this chapter, therefore, is to introduce the concept of Arrays in Ruby and provide an overview of the creation and manipulation of such objects. In the next chapter ([[Advanced Ruby Arrays]]) we will look at more ways to work with arrays.
== What is a JavaScript Ruby Array ==
A Ruby array is an object that contains a number of items. Those items can be variables (such as String, Integer, Fixnum Hash etc) or even other objects (including other arrays to make a multidimensional array). Once you have grouped all the items into the array you can then perform tasks like sorting the array items into alphabetical or numerical order, accessing and changing the value assigned to each array item, and passing the group of items as an argument to a Ruby function.

Navigation menu