The conditional statements are if and unless, and they allow you to control the execution of your script. There are five different formats for the if statement:

The first format is classed as a simple statement, since it can be used at the end of another statement without requiring a block, as in:
In this instance, the message will only be printed if the expression evaluates to a true value.
The second format is the more familiar conditional statement that you may have come across in other languages:
This produces the same result as the previous example.
The third format allows for exceptions. If the expression evaluates to true, then the first block is executed; otherwise (else), the second block is executed:
The fourth form allows for additional tests if the first expression does not return true. The elsif can be repeated an infinite number of times to test as many different alternatives as are required:
The fifth form allows for both additional tests and a final exception if all the other tests fail:
The unless statement automatically implies the logical opposite of if, so unless the EXPR is true, execute the block. This means that the statement
For example, the following is a less elegant solution to the preceding if…else. Although it achieves the same result, example:
The final conditional statement is actually an operator.the conditional operator. It is synonymous with the if…else conditional statement but is shorter and more compact. The format for the operator is:
For example, we can emulate the previous example as follows:

What Do You Think on This ? Say Here