PC SOFT

WINDEVWEBDEV AND WINDEV MOBILE
ONLINE HELP

Home | Sign in | English UK
  • Other statements used to exit from a loop or from a procedure
  • Using the RETURN keyword to return a value
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
RETURN statement
In french: Retour
The RETURN statement is used to exit from a statement block and to exit from the current process (or procedure).
The RETURN statement can be used in:
Versions 16 and later
In a procedure, you also have the ability to assign a value to the RETURN keyword. This value can be re-read at any time. This value will be automatically returned when exiting from the procedure (standard exit from the procedure or exit from the procedure via the RETURN keyword).
New in version 16
In a procedure, you also have the ability to assign a value to the RETURN keyword. This value can be re-read at any time. This value will be automatically returned when exiting from the procedure (standard exit from the procedure or exit from the procedure via the RETURN keyword).
In a procedure, you also have the ability to assign a value to the RETURN keyword. This value can be re-read at any time. This value will be automatically returned when exiting from the procedure (standard exit from the procedure or exit from the procedure via the RETURN keyword).
Versions 16 and later
Universal Windows 10 App This feature is available for the Windows Phone applications.
New in version 16
Universal Windows 10 App This feature is available for the Windows Phone applications.
Universal Windows 10 App This feature is available for the Windows Phone applications.
Versions 17 and later
iPhone/iPad This feature is available for the iPhone/iPad applications.
New in version 17
iPhone/iPad This feature is available for the iPhone/iPad applications.
iPhone/iPad This feature is available for the iPhone/iPad applications.
Versions 18 and later
Universal Windows 10 App This feature is available in Windows Store apps mode.
Android Widget This feature is available in Android Widget mode.
New in version 18
Universal Windows 10 App This feature is available in Windows Store apps mode.
Android Widget This feature is available in Android Widget mode.
Universal Windows 10 App This feature is available in Windows Store apps mode.
Android Widget This feature is available in Android Widget mode.
Versions 21 and later
Universal Windows 10 App This feature is available in Universal Windows 10 App mode.
Apple Watch This feature is available in Apple Watch mode.
New in version 21
Universal Windows 10 App This feature is available in Universal Windows 10 App mode.
Apple Watch This feature is available in Apple Watch mode.
Universal Windows 10 App This feature is available in Universal Windows 10 App mode.
Apple Watch This feature is available in Apple Watch mode.
Syntax

Procedure

PROCEDURE <Procedure Name> ([<Parameter>])
  IF <Condition> THEN RETURN
  ...
  END

FOR statement

FOR <Control Variable> = <Initial Value> TO <Final Value> [STEP <x>]
  IF <Condition> THEN RETURN
END

FOR EACH statement

FOR EACH <File> ON <Key Item>
  IF <Condition> THEN RETURN
END

LOOP statement

LOOP
  ...
  IF <Condition> THEN RETURN
  ...
END

WHILE statement

WHILE <Condition 1>
  ...
  IF <Condition> THEN RETURN
  ...
END
The following operations are performed if <Condition> is True:
  • Exit from the statement block.
  • Exit from the current process (or procedure).
Remarks

Other statements used to exit from a loop or from a procedure

Several statements are available:
  • RESULT: Return a status report to the calling process. Exit from the loop and exit from the current process (or procedure).
  • BREAK: Exit from the loop and run the rest of the current process (or procedure).
Close is used to exit from the loop (or procedure) and to close the current window.
Caution: The RETURN and RESULT statements cannot be used in the same process.
Versions 16 and later

Using the RETURN keyword to return a value

In a procedure, you also have the ability to assign the return value before the actual exit from the procedure. For example:
...
RETURN = fReadLine(nFile)
fClose(nFile)
You also have the ability to re-read the value assigned by RETURN so that there is no need to declare a local variable to contain the result. For example:
IF RETURN = 1 THEN...
The value assigned to RETURN will be returned to the calling process:
  • at the end of procedure
  • when using the RETURN keyword to exit from the process (equivalent to the RESULT statement).
New in version 16

Using the RETURN keyword to return a value

In a procedure, you also have the ability to assign the return value before the actual exit from the procedure. For example:
...
RETURN = fReadLine(nFile)
fClose(nFile)
You also have the ability to re-read the value assigned by RETURN so that there is no need to declare a local variable to contain the result. For example:
IF RETURN = 1 THEN...
The value assigned to RETURN will be returned to the calling process:
  • at the end of procedure
  • when using the RETURN keyword to exit from the process (equivalent to the RESULT statement).

Using the RETURN keyword to return a value

In a procedure, you also have the ability to assign the return value before the actual exit from the procedure. For example:
...
RETURN = fReadLine(nFile)
fClose(nFile)
You also have the ability to re-read the value assigned by RETURN so that there is no need to declare a local variable to contain the result. For example:
IF RETURN = 1 THEN...
The value assigned to RETURN will be returned to the calling process:
  • at the end of procedure
  • when using the RETURN keyword to exit from the process (equivalent to the RESULT statement).
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment