Alternatively called elsif, else if is a conditional statement performed after an if statement that, if true, performs a function. Below is an example of an if, elsif, and else conditional statement in Perl.
#!/usr/bin/perl
print “Enter number: “;
my $number =
The above example shows how elsif could be used to create an additional conditional statement and not only an if or else statement. The above example could also be extended by adding as many elsif or else if statements as the program needed.
Conditional statement, Else, If statement, Programming terms
Not all programming languages are the same. Although the example above used elsif, in a different language, such as ANSI C or Python, you would use else if or elif respectively.
Related information
- How to create a computer program.