|
<< Click to Display Table of Contents >> ELSEIF |
![]() ![]()
|
An ELSEIF statement can be used to filter through different conditions and is used in conjunction with an IF condition and an END statement. The syntax for this is simpler than using ELSE and IF instead, cf. the examples.
ELSEIF can be used to sift through possibilities, like this:
%x = 1; |
The same can be done without using ELSEIF, but in that case a number of END's need to be added:
%x = 1; |
These END's are inconvenient and stems from the fact that the above code can be reorganized into the following structure:
%x = 1; if (%x == 2); if (%x == 3); end; end; |
Here it is more clear why there are three ending END's. Using ELSEIF avoids that.