If, Else, and Elsif
Ruby allows conditional execution using if, else, and elsif statements.
Syntax:
age = 18
if age >= 18
puts "You are an adult."
elsif age > 12
puts "You're a teenager."
else
puts "You're a child."
endYou can also write single-line conditions:
puts "You can vote!" if age >= 18