Go to a label¶
This custom action action transfers the package execution to the statement marked by the specified label. To mark a statement, you must first declare the label using the "Define a label" custom action. See an example below.
Property Name | Data Type | Description |
---|---|---|
LabelName | TLabelName (String) | Identifies the label the script will jump to. A label name can be any valid identifier or any numeral between 0 and 9999, like LABEL1, RETURN25, etc. |
All labels must be declared with a "Define a label" custom action before they can be used with a Go To Label custom action.
Example of using Go to label¶
On this screenshot you can see an example of the use of "Define a label"/"Go to a label" custom actions. We ask end users for their name and create a kind of loop: they will be prompted to enter their name until they answer a non-blank value.
This can be used to check values provided by users (folders, etc...), to jump to specific blocs of instructions when a condition is not met, etc...
Some restrictions you should know¶
-
"Go to a label" custom actions should not be used too much: only for simple examples like the previous one.
-
Although you are allowed to do this, you should not jump to a label that is not in the same event as the "goto" action. Paquet Builder automatically adds internal actions that occur between the events: if you use incorrect jumps, this can have unpredictable effects.
-
If a goto-label statement is not correctly defined, the C code compiler will raise an exception when compiling the script generated from custom actions.