From the course: Complete Guide to Ruby
Unlock the full course today
Join today to access over 24,700 courses taught by industry experts.
Arrays - Ruby Tutorial
From the course: Complete Guide to Ruby
Arrays
- [Instructor] In this movie, we will learn about arrays, which are an important object type in Ruby, and a common feature of many programming languages. An array is an ordered, integer-indexed collection of objects. That's a fancy way of saying that we're going to put objects into an ordered list and then refer to them by their positions in that list. That's what integer-indexed means. We can request the first object, the fifth object, and so on. You can think of an array as being like an expanding file folder. You might store your electric bill in the first pocket and your phone bill in the second pocket and your car payment in the third pocket, and so on. There's a set order to the pockets and you can move papers in and out of those pockets. Some pockets can be empty, but that empty space in the order will be preserved. Unlike a file folder, though, arrays have an unlimited number of pockets. In Ruby, the count of the pockets, or positions in the array, starts with 0. We call them…
Contents
-
-
-
-
(Locked)
Objects2m 30s
-
Variables3m 26s
-
(Locked)
Numbers: Integers3m 46s
-
(Locked)
Numbers: Floats4m 4s
-
(Locked)
Strings5m 34s
-
(Locked)
Strings: Escaping and interpolation5m 36s
-
(Locked)
Arrays5m 35s
-
Array methods6m 59s
-
(Locked)
Hashes5m 2s
-
(Locked)
Symbols5m 41s
-
(Locked)
Booleans5m 29s
-
(Locked)
Ranges5m 16s
-
(Locked)
Constants2m 53s
-
(Locked)
Nil2m 57s
-
(Locked)
Challenge: Roman numerals1m 2s
-
(Locked)
Solution: Roman numerals1m 19s
-
(Locked)
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-