The set of statements1 is executed,If condition1 is evaluated as True; if condition1 is evaluated as False, then condition2 is evaluated and if this expression is evaluated as True, then the set of statements2 is executed;
if the expression is evaluated as False, then the condition3 is evaluated, and so forth for as many tests as are coded.
In case none of the previous tests is evaluated as True,the final, optional, Else condition is provided . It is "default" condition and The point of the structure is that only one of the parallel tests can be evaluated as True, and only one set of statements is executed.
The example below uses a set of If...ElseIf statements to check whether an entered character is in the first, middle, or last third of the alphabet.
|