Else

Updated: 04/26/2017 by Computer Hope

elseElse is a programming conditional statement that if previous conditions are not true displays alternate information or performs alternate commands.

my $x = 10;
if ($x == 10) { print "X is equal to 10"; }
else { print "X is not equal to 10";

Above is an example of Perl code that first sets the x variable as 10. If this value remains 10, then the first if statement prints "X is equal to 10". However, if this value changes it would print "X is not equal to 10".

Conditional statement, Else if, If statement, Programming terms