ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage syntax / Structured statements
  • Label code
  • Limits of labels
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
GOTO statement
In french: GOTO
The GOTO statement is used to run a code identified by a label.
Important The label must be defined in the same process as the GOTO INSTRUCTION.
}
Example
Res = fOpen(NomFichier, foWrite)
IF Res = -1 THEN GOTO ERROUVRE
Res = fWrite(Res, "Traitement OK")
IF Res = -1 THEN GOTO ERRECRIT
...
RETURN True
ERROUVRE : 
Info("Le fichier " + NomFichier + " ne peut être ouvert. Vérifiez son existence.")
RETURN False
ERRECRIT : 
Info("Il est impossible d'écrire dans le fichier " + NomFichier)
RETURN False
Syntax
GOTO <Label name>
...
<Label name>:
<Label code>
<GOTO>:
Runs the code identified by the label.
<Label name>:
Name of label whose code must be run. This name must be followed by ":". This label and the GOTO statement must be found in the same process.
<Label code>:
Code that must be run when GOTO calls the label.
Remarks

Label code

Once the code of the label has been run, the program runs the lines of code that directly follow the label.

Limits of labels

  • Several labels with the same name cannot be used in the same process (or procedure).
  • A warning is displayed during the compilation of the project if a label is used by no GOTO statement.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 03/27/2025

Send a report | Local help