swirl
Guide to OmniMark 7   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 ] [ LEGACYLIBRARIES ] [ ERRORS ]

OmniMark 7.1.2 Documentation Generated: June 28, 2005 at 5:45:44 pm
If you have any comments about this section of the documentation, send email to [email protected]

Copyright © Stilo Corporation, 1988-2005.