Return command

Unofficial Content
This documentation is valid for:

Ends the execution and returns to the calling program.

Syntax

Return

Description

This command forces GeneXus to leave the Program and return to the caller - It can be another Procedure or Panel.

The Return command can be specified anywhere within the Program.

Scope

    Objects: Procedures, Transactions, Web Panels, Panel for Smart DevicesWork With for Smart Devices    

    Languages: .NET, Java

    SD Generators: iOS, AndroidWindows10

Note

  • When the Return command is used within a For each sentence you must remember that the database updates are performed immediately before the Endfor. A generic example is given below:
For each
    att = value
    If <condition_is_true>
        Return
    Endif
EndFor 

When the condition is satisfied and the return command is executed, the attribute is not modified at that moment in the database because the actual database update is performed just before the Endfor.

A particular example could be: The Supplier Code is checked to see if it is valid; if it is not valid the control is returned back to the caller.

&Flag = 0
For each
    where SupCod = &SupCod
    &Flag = 1
EndFor

If &Flag = 0 // Supplier not valid
    Return
EndIf