
- Ruby
- Beginner
About this Course
In this course, you’ll learn all about blocks in Ruby. Blocks are a piece of syntax that you can use in Ruby to accomplish all kinds of amazing programming feats. Ruby programmers make constant use of blocks so they are an important piece of the language to learn.
What you'll learn
- Ruby Blocks
- Ruby Classes
- Block Arguments
- Yield
Ruby Blocks
In this stage, you'll learn how blocks work in Ruby. You'll learn what blocks are, different ways they can be called, and how to pass arguments to a block.
8 stepsWorking With Blocks
It's important to learn how blocks work in the real world. In this stage, you'll explore how blocks work in some of Ruby's built in types. You'll also learn how to create your own classes that implement methods with blocks.
8 steps-
Blocks in the Wild: Strings and Integers
4:58
-
Block Method Practice: Strings
1 objective
-
Blocks in the Wild: Arrays and Hashes
7:06
-
Block Method Practice: Arrays
1 objective
-
Build a Simple Benchmarker
6:31
-
Block Method Practice: Custom Classes
2 objectives
-
Implementing Block Methods
3:30
-
Implementing Block Methods
1 objective
Blocks Practice
It's important to practice what you've learned! In this stage, we'll practice using blocks by writing a Monster class that makes heavy use of blocks, hashes, and more.
8 stepsTeacher
-
Jason Seifer
Jason helped launch Treehouse and spent 4 years teaching here before returning to Rails development full time.