Conditional Statements
Use if, else, elsif, and case statements to control which code executes based on conditions.
1
Conditional Statements
Conditional statements allow your Ruby programs to make decisions based on conditions.
In this lesson, you will learn how to use if, else, elsif, and case statements.

2
Using If and Else
The if statement executes code only if a condition is true. The else statement runs if the condition is false.
age = 18
if age >= 18
puts 'You are an adult'
else
puts 'You are a minor'
endAll lessons in this course
- Conditional Statements
- Loops and Iterators
- Logical and Comparison Operators