Difference between revisions of "Advanced Ruby Arrays"
From Techotopia
(New page: In the Understanding Ruby Arrays we looked at the basics of arrays in Ruby. In this chapter we will look at arrays in more detail. == Combining Ruby Arrays == Arrays in Ruby can be c...) |
(No difference)
|
Revision as of 20:29, 26 November 2007
In the Understanding Ruby Arrays we looked at the basics of arrays in Ruby. In this chapter we will look at arrays in more detail.
Combining Ruby Arrays
Arrays in Ruby can be concatenated using a number of different approaches. One option is to simply add' them together:
days1 = ["Mon", "Tue", "Wed"] days2 = ["Thu", "Fri", "Sat", "Sun"] days = days1 + days2 => ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
Arrays can also be combined using the << operator:


