While loops are some of the most primitive ways of cycling through data. This lesson is all about loops, so it's sure going to be a fun one. The first loop that we'll see is the While loop.
Being able to cycle through a list of values is something that you'll be doing on a daily basis. In this lesson, we are going to go through Ruby's popular iterator - the Each loop.
If you're coming from other programming languages, you should be familiar with For loops. Ruby also has these loops, but they are not used frequently in real-world applications. This is mainly because the Each loop is more popular and easier to work with.
In this video, we are going to walk through on how to build a nested iterator with a practical example, namely looping over a nested Hash in Ruby.
The select method is a powerful method that automatically iterates through a collection in a Ruby program and extracts the values you want. Enumerators are a fun and very powerful way of working with collections in Ruby, and after you get used to implementing the methods I think you'll be shocked at how efficient it is integrate advanced functionality.
In the next few lessons, we are going to be covering the map method - a popular method used by Ruby developers almost on an everyday basis due to its flexibility and usefulness.
In this lesson, we are going to go much deeper into the map method and explore practical ways of using the method.
In this lesson, I'm going to show you how to sum up values in Ruby by implementing the powerful `inject` method and iterating over an array. Being able to sum up values in an array is something you will most likely need on a regular basis and Ruby makes this very straightforward to implement.
devCamp does not support ancient browsers.
Install a modern version for best experience.