Conditional Statements:

IF

if ($a == 10) {
     print "variable equals 10.\n";
}


IF/ELSE

if ($a < 10) {
     print "condition is true.\n";
}
else {
     print "condition is false.\n";
}

IF/ELSE IF

if ($a < 10) {
     print "less than 10.\n";
}
else if ( ($a >= 10 ) && ( $a < 20) )  {
     print "greater than or equal to 10 but less than 20.\n";
}
else {
     print "greater or equal to 20.\n";
}


NESTING IF STATEMENTS

if ($a < 10) {
     print "less than 10.\n";
     if ($a < 5) {
          print "also less than 5.\n";
     }
}

SWITCH

int $a;

switch ($a) {
     case 1:
          print "equals 1\n";
          break;
     case 5:
          print "equals 5\n";
          break;
     case 10:
          print "equals 10\n";
          break;
     default:
          print "didnt match any above\n";
          break;
}