Class Central is learner-supported. When you buy through links on our site, we may earn an affiliate commission.

Treehouse

Ruby Loops Course (How To)

via Treehouse

Overview

In Ruby Loops, you'll learn how to automatically repeat statements using Ruby. You'll learn about the loop construct, including while loops, until loops, for loops, and more. You'll also learn the basics of iteration and then move on to creating a simple contact list management program.

What you'll learn

  • Loops
  • Iteration
  • Conditional Logic

Syllabus

Ruby Loops

A loop is used to repeat statements until a condition is met. Ruby offers several different kinds of loops: the loop, while loop, and until loop.

Chevron 8 steps
  • Ruby Loops

    5:19

  • The Ruby Loop

    1 objective

  • Loop Conditionals

    7:13

  • Loop Conditionals

    1 objective

  • The While Loop

    4:59

  • The While Loop

    1 objective

  • The Until Loop

    3:08

  • The Until Loop

    1 objective

Ruby Iteration

Iteration can be used to loop through values in Arrays, Hashes, and other Ruby types. In this stage, we'll learn how to iterate over arrays and hashes. We'll also learn how to do other types of iteration using the for and times constructs.

Chevron 8 steps
  • Iteration With Each

    4:51

  • Iteration With Each

    1 objective

  • Hash Iteration

    3:41

  • Hash Iteration

    1 objective

  • Times Iteration

    2:21

  • Iteration With Times

    1 objective

  • For Loops

    2:55

  • The For Loop

    1 objective

Build a Simple Contact List

Using the concepts of loops and iteration, we'll build a simple contact list program using Ruby. Along the way, we'll be writing methods to make our work easier.

Chevron 6 steps
  • Part 1: Asking Questions

    3:10

  • Methods That Return a Value

    1 objective

  • Part 2: Adding Contacts

    4:44

  • Assigning Hash Values From Methods

    3 objectives

  • Part 3: Printing The Contact List

    3:51

  • Hash and Array Iteration

    1 objective

Reviews

Start your review of Ruby Loops Course (How To)

Never Stop Learning.

Get personalized course recommendations, track subjects and courses with reminders, and more.

Someone learning on their laptop while sitting on the floor.