Conditions

age = 18

if age >= 18
puts “You are an adult.”
elsif age >= 13
puts “You are a teenager.”
else
puts “You are a child.”
end
if … elsif … else … end is used for decision making.
Output:


You are an adult.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *