Join Kevin Skoglund for an in-depth discussion in this video Array methods, part of Ruby Essential Training.
- View Offline
- Exercise Files
In the last movie we saw the fundamentals of creating an array, putting objects…into it, and taking objects out.…But there is a lot more that we can do to manipulate with arrays.…So I want to spend another movie really looking at some of these array methods,…to see how they work.…I am going to open up irb, and let's go ahead and just create an array.…I am just going to call it array = 1,2, 3,4,5, and I am going to create another one…I will call array2.…I know it's not a very descriptive name, but for our purposes this will work.…I just want to show you that this is 1, and let's put in 2, and then 3.0, and…then while we are at it let's go ahead and put in a, b, and last of all, let's put in dog.…
There we go.…I want to show you, first of all, with that array2 that we can mix these types…in there, and the array doesn't care.…We saw how we can return different values.…It works exactly the same way with the mix types.…Now, we have two arrays that we can work with.…The first thing I want to show you is that we can do inspect, array.inspect.…
- Using Ruby in the Interactive Ruby Shell and in standalone scripts
- Learning to write custom code blocks to find, merge, and sort
- Using modules for namespacing or as mix-ins
- Reading from and writing to files
- Creating a full Ruby project from start to finish
Skill Level Beginner
1. Getting Started with Ruby
2. Ruby Object Types
3. Control Structures
4. Code Blocks
8. Working with Files
9. Ruby Project: Creating the Food Finder
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.