elseif Structure

InstallShield 2019 » InstallScript Language Reference

InstallScript provides the elseif statement to create if structures in which the else branch of one if statement leads to another if statement:

    if (first condition) then

        // statements to be executed if first condition

        // is true

    elseif (second condition) then

        // statements to be executed if first condition

        // is false and second condition is true

    elseif (third condition) then

        // statements to be executed if first and second

        // conditions are false and third condition is

        // true

    endif;

In the following example, if szStringA equals “exit,” AskYesNo is called. If szStringA is not equal to “exit,” the program continues to the elseif statement to test if szStringA is equal to “continue.” If szStringA is equal to “continue,” the result is TRUE and MessageBox is called. If szStringA is not equal to “continue,” the program moves to the next elseif, and so on.

    if szStringA = "exit" then

        AskYesNo ("Are you sure you want to exit?", NO );

    elseif szStringA = "continue" then

        MessageBox ("Please wait...", INFORMATION );

    elseif szStringA = "reboot" then

        goto StartHere;

    endif;

Note • You cannot define a label within an if statement.

See Also