if-elsif-else Statement
Let's discuss if-elsif-else statements using different examples in this lesson.
We'll cover the following
The elsif
statement
When there are different possible actions against a set of different conditions, then elsif
is used to extend the if
statement. The conditional block starts with an if-statement followed by multiple elsif
statements, each with a different condition, and may end with an optional else-statement.
Syntax
The syntax and usage of the if-statement with the elsif
statement are presented in the following example.
Create a free account to access the full course.
By signing up, you agree to Educative's Terms of Service and Privacy Policy