Ruby Collections Course (How To)
Offered By: Treehouse
Course Description
Overview
In the Ruby Collections course at Treehouse, you'll level up your Ruby knowledge and start learning about collections. We use two basic data structures to create collections in Ruby: arrays and hashes. These are both examples of "collections" and you’ll work with them a lot in your career as a Ruby programmer. During the course, we'll be writing simple programs that build on what we learned in this course and in previous courses.
What you'll learn
- Ruby Arrays
- Ruby Hashes
- Ruby Collections
Syllabus
Ruby Arrays
An array is a container of data, similar to a list. Arrays can be used to store many different kinds of data including strings, numbers, and almost any other kind of Ruby object. In this stage, we'll learn how to create and manipulate arrays.
Chevron 8 steps-
Ruby Arrays
5:03
-
Creating an Array
1 objective
-
Adding Items to Arrays
3:26
-
Adding Items to Arrays
2 objectives
-
Accessing Items in Arrays
4:42
-
Accessing Items in Arrays
3 objectives
-
Removing Items From Arrays
3:43
-
Removing Items From Arrays
2 objectives
Ruby Hashes
A hash is data structure similar to an array. Hashes are used all throughout Ruby programs. In this stage, we'll get comfortable creating and working with hashes in Ruby.
Chevron 8 steps-
Ruby Hash Creation
6:35
-
Ruby Hash Creation
2 objectives
-
Working with Hash Keys
4:28
-
Working with Hash Keys
1 objective
-
Working with Hash Values
2:00
-
Working with Hash Values
2 objectives
-
Hash Methods
6:52
-
Hash Methods
1 objective
Build a Grocery List Program
Now that we know how to use arrays and hashes, we're going to build a small program that makes a grocery list for us. We'll combine all of the knowledge we've learned so far including input and output, method definitions, and more.
Chevron 9 steps-
Build a Grocery List Program: Part 1
3:15
-
Create a Method That Returns a Hash
1 objective
-
Build a Grocery List Program: Part 2
3:58
-
Create a Method That Returns an Array
1 objective
-
Build a Grocery List Program: Part 3
3:47
-
Method Returns with Hashes and Arrays
1 objective
-
Build a Grocery List Program: Part 4
4:17
-
Working with Hashes That Contain Arrays
1 objective
-
Ruby Collections: Review
6 questions
-
Extra Credit
On your own, research how to use loops and modify our grocery list program to continually ask for input rather than only ask for three different items.
Related Courses
Learn RubyCodecademy Introduction to Computer Science and Programming
Tokyo Institute of Technology via edX Ruby Programming Language - Full Course
freeCodeCamp App Engine: Qwik Start - Ruby
Google Cloud via Coursera Using the Natural Language API with Ruby
Google Cloud via Coursera