Conditional Logic in Ruby

Watch out! This tutorial is over 7 years old. Please keep this in mind as some code snippets provided may no longer work or need modification to work on current systems.

This is the conventional use of the if in perl. Notice that there is no need for curly braces ({ and }). The body of the if ends with the appropriate keyword, endelse or elsif. The then word is generally optional, though you need it if you want to put start the body on the same line as the if, the way the last statement does.

Continue reading