Nested if-then-else Structure

InstallShield 2019 ยป InstallScript Language Reference

You can create nested if statements, in which one if statement is embedded in another:

    if (first condition) then

        if (second condition) then

            // statements to be executed if first and

            // second conditions are true

        else

            // statements to be executed if first is true but

            // second condition is false

        endif;

    else

        if (third condition) then

            // statements to be executed if first condition is

            // false and third condition is true

        else

            // statements to be executed if first condition is

            // false and third condition is false

        endif;

    endif;

In the following example, if the value of szStringA is "exit", AskYesNo is called. If the value of szStringA is "exit", the program displays a message box. if szStringA is not equal to either of those values, the execution proceeds to the label UserErrorHandler.

    if szStringA = "exit" then

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

    else

        if szStringA = "continue" then

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

        else

            UserErrorHandler;

        endif;

    endif;

See Also