Click here to navigate the course.

Drag the edges to resize the window.

In Projects, you can keep track of your progress as you go throught the tasks. Check each item as you complete it!

Code Editor
Learn
Control Flow in Ruby

Elsif

What if you want more than two options, though? It's elsif to the rescue! The elsif statement can add any number of alternatives to an if/else statement, like so:

if x < y # Assumes x and y are defined puts "x is less than y!" elsif x > y puts "x is greater than y!" else puts "x equals y!" end
Report a Bug
If you see a bug or any other issue with this page, please report it here.