swirl
Guide to OmniMark 8   OmniMark home
docs home 
IndexConceptsTasksSyntaxLibrariesLegacy LibrariesErrors
 
     
action  

return

 
 

Syntax

return (expression)?


Purpose

To return a value from a function, use the return keyword followed by an expression of the same type as the function return type. Executing the return keyword exits the function, so code after return will not be executed.

If the function contains an always block, the code in the always block will be executed after the return statement is executed and before the function terminates. The return value of the function is determined when return is executed, and cannot be changed in the always block. (You can place the return statement in the always block, in which case return will exit the function when it is executed, and the rest of the code in the always block will not be executed.)

In the following code, return is used to return the result of the function:

  define integer function sum
      (value integer x,
       value integer y
      ) as
  
      return x+y

You can also use return by itself to exit from an action function. If you do not exit an action function with return, it will exit automatically once all the code is executed. A value-returning function, however, must return a value.

       
 

Top [ INDEX ] [ CONCEPTS ] [ TASKS ] [ SYNTAX ] [ LIBRARIES ] [ LEGACY LIBRARIES ] [ ERRORS ]

OmniMark 8.2.0 Documentation Generated: March 13, 2008 at 3:33:48 pm
If you have any comments about this section of the documentation, please use this form.

Copyright © Stilo International plc, 1988-2008.