unless statement with else : unless « Statement « Perl






unless statement with else

  


$variable = 6;

unless ($variable == 5) {
    print "No, it's not five.\n";
} else {
    print "Yes, it's five.\n";
}

   
    
  








Related examples in the same category

1.Conditional operator: The unless Modifier
2.The unless Construct
3.The unless statement is the opposite of if and executes a block unless a condition is true.
4.Using unless with regular expression
5.unless statement
6.unless statement in while
7.unless statement with elsif