Table of Contents

More About If: Multiples

More about if statements. Run this:


if ($age > $max) {
        print "Too old !\n";
} else {
        print "Young person !\n";

It is easy to see what else does. If the expression is false then whatever is in the else block is evaluated (or carried out, executed, whatever term you choose to use). Simple. But what if you want another test ? Perl can do that too.