Archive for April 21st, 2008

Unless

April 21st, 2008 | Category: Basics, Sample Code

Unless is another control structure similar to “if..else’ that is for conditional processing and it is used as follows:

unless condition
instruction1
else
instruction2
end

Again, it uses the “end” statement to terminate the control structure. The “case”, control is more of a screening process that allows say the element of an array or hash to be evaluated to meet a specific set of conditions. It is used as follows:

case variable
when condition1
instruction1
when condition2
instruction2
……
……
when conditionX
instructionX
else instructionA
end

Comments are off for this post