ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage syntax / Structured statements
  • Operating mode
  • Special case
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
The END: label is used to define a code that will be systematically run at the end of process execution. This code will be run even if the exit from process is performed by RETURN or RETURN (except for an exception process triggered by ExceptionThrow).
Example
PROCEDURE CompareContent(File1, File2)
 
// Opens the files
nFile1 is int = fOpen(File1, foRead)
nFile2 is int = fOpen(File2, foRead)
 
// Returns -3 if an opening error occurred
IF nFile1 = -1 OR nFile2 = -1 THEN RESULT -3
 
// Reads the first line of each file
sLine1 is string = fReadLine(nFile1)
sLine2 is string = fReadLine(nFile2)
nLine is int = 1
 
LOOP
// If the two lines are empty, the end of the two files has been reached
// Returns 0
IF sLine1 = EOT _AND_ sLine2 = EOT THEN RESULT 0
 
// If end of file 1, the file 1 is shorter
// returns -1
IF sLine1 = EOT THEN RESULT -1
 
// If end of file 2, the file 2 is shorter
// returns -2
IF sLine2 = EOT THEN RESULT -2
 
// If the lines are different, returns the number of the different line
IF sLine1 <> sLine2 THEN RESULT nLine
 
// Goes to the next line
sLine1 = fReadLine(nFile1)
sLine2 = fReadLine(nFile2)
nLine++
END
 
END:
// Closes the files
fClose(nFile1)
fClose(nFile2)
Syntax
// Main code
...
IF ...THEN
  ...
  RESULT 0
END
...
IF ...THEN
  ...
  RESULT 1
END

RESULT 2

// Statements run in all cases
// at the end of process execution
END:
...
Remarks

Operating mode

The value to return is stored and the code following the "END:" label is run. The value is returned at the end of execution of the code following the "END:" statement
Remark: The END: label is also run after the automatic management of errors if this one is enabled (by "CASE ERROR:" and "CASE EXCEPTION:").

Special case

The code following the "END:" label is not run after a call to SetFocusAndReturnToUserInput or to Close. SetFocusAndReturnToUserInput can be replaced with the call to ScreenFirst followed by RETURN or RESULT.
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help