Archive for March 13th, 2008

Ruby Arrays. Hashes and Ranges (Part 1)

March 13th, 2008 | Category: Basics,Sample Code

We now move onto data structures which are the forms of data that Ruby operates on. Remember, the language is designed more for web applications so these are mainly basic stuff which would be followed by more complicated instructions. Arrays are used to store several data elements and can be compared to a container you use to store all the noodles in a restaurant. That restaurant has an online order facility that takes orders and tells the clerk which items are taken from the inventory for use in a particular pasta recipe. For regular spaghetti, it may look some thing like :

Sample Array:
Spaghetti Sauce: [ground pork, ground beef, tomato sauce, garlic, pepper, onions, salt, olive oil]

More on Arrays in the next post.

Comments are off for this post