Ruby has various control structures, many of which you will be familiar with. A control structure executes statements until the condition is not false. Any value that is not nil or false is treated as true. For some of you who are comfortable with C++ or Java, you may sometimes find it confusing that 0 and empty string are not false.
The if-elsif-else-end control structure in Ruby is exactly the same as that in other programming languages:
if <condition> <statements> elsif <condition> <statements> else <statements> end
Here is an example:
a = 1 b = 2 if a > b puts "The value of a is greater than the value of b" elsif a < b puts "The value of a is less than the value of b" else puts "The value of a is equal ...