Ruby

Learn to program in Ruby, a flexible language used to create sites like Codecademy.
Start

800k+

enrolled students

9 Hours

estimated course time

Beginner

required technical level

Introduction to Ruby

Introduction to Ruby

This tutorial will introduce you to Ruby, an object-oriented scripting language you can use on its own or as part of the Ruby on Rails web framework.

Putting the Form in Formatter

Now that you know a little bit of Ruby, let's put together your first project! In this one, we'll write a small program that will format a user's input.

Control Flow in Ruby

Control Flow in Ruby

Now that we know how to write simple programs, let's learn how to write more complex programs that can respond to user input.

Thith Meanth War!

Using control flow, we can modify a user's input and return it to them. In this project, we'll make them sound like Daffy Duck!

Looping with Ruby

Loops & Iterators

Using loops and iterators, Ruby can automate repetitive tasks for you quickly and easily.

Redacted!

In this project we'll make a program that searches a string of text for your name and, if it finds it, replaces it with the word "redacted." Just like that, you're a spy!

Arrays and Hashes

Data Structures

You already know a little bit about arrays. This lesson will teach you more about arrays, about a new data structure called a hash, and how Ruby can iterate over both to help you build better programs.

Create a Histogram

In this project, we'll write a program that reads a block of text and tells us how many times each word appears.

Blocks and Sorting

Methods, Blocks, & Sorting

In this lesson, we'll cover how to define our own methods in Ruby, as well as how to use blocks to develop powerful sorting algorithms.

Ordering Your Library

In this project, we'll design a single Ruby method to sort large quantities of data in either ascending or descending order.

Hashes and Symbols

Hashes and Symbols

As we've seen, hashes are an important Ruby data structure. Here, we'll learn about the (chunky) bacon to hashes' eggs: symbols!

A Night at the Movies

In this project, we'll use our knowledge of Ruby hashes and symbols to construct a program that displays, adds, updates, and removes movie ratings!

Refactoring

The Zen of Ruby

In this course, we'll look at the best practices and conventions that make Ruby unique.

The Refactor Factory

In this project, we'll use step-by-step refactoring to vastly improve the readability and structure of a program.

Blocks, Procs, and Lambdas

Blocks, Procs, and Lambdas

In this course, we'll cover three of the most powerful aspects of the Ruby programming language: blocks, procs, and lambdas.

Object-Oriented Programming, Part I

Object-Oriented Programming I

Ruby is an object-oriented language. In this lesson, we'll cover objects, classes, and how they're used to organize information and behavior in our programs.

Virtual Computer

Often programmers use virtual machines to simulate real computers. While we won't be building a real VM, in this project, we'll use Ruby classes to create our own imaginary computer that stores data!

Object-Oriented Programming, Part II

Object-Oriented Programming II

In this lesson, we'll cover more advanced aspects of OOP in Ruby, including information hiding, modules, and mixins.

Banking on Ruby

Now that we know all about hiding information in Ruby, let's apply our new skills to write a program that can store, update, and display a bank account balance.