The goto keyword is used to branch directly to the statement immediately following a specified label. In the following code fragment, the goto statement causes execution to continue with the AskText statement.
Name:AskText("Company name:", "", szSrc);if (szSrc = "") thenMessageBox("Please enter the company name.", SEVERE);goto Name;endif;
A goto statement in the main program must specify a label that has been declared in the main program. A goto statement in a function must specify a label that has been declared in that function.
InstallScript supports a special form of the if statement that can be used only with goto statements:
if condition goto labelname;
This special structure is has the following features:
- The condition must be followed by a goto statement.
- The keyword then is not used.
- The keyword endif is not used.
In the following example, the user will be prompted to enter a company name as long as szSrc is a null string (“”).
Name:AskText("Company name:", "", szSrc);if (szSrc = "") goto Name;
668

被折叠的 条评论
为什么被折叠?



