Implementation of the Function Content
- Updated2025-10-31
- 2 minute(s) read
Implementation of the Function Content
Local variables can be created and used to implement the function. The return keyword can be used to terminate evaluation of a function prematurely.
It is also possible to use the entire functionality of PAscript.
Local Variables
Local variables in functions are defined in analogy to local functions of the main program.
Validity of Local Variables
The difference between local variables in the program and in functions is as follows:
- Local variables in the program retain their value even after the program has been terminated. If the program is called again these variables have the value from the last time the program ran.
- This is not true for local variables in functions. Once the function has been processed and control has passed back to the caller, the content of the variable is deleted. The next time the function is called these variables have their initialization value.
Return
The return keyword is used to end the function sequence and return to the caller of the function. The current return values at that time are transferred to the caller. In contrast to calling return directly in the program, however, all processing of the program is not terminated in this case.
Example

If in the example above parameter mode has value 1, the return value value is written with -input and then the function evaluation is finished. If mode should be unequal to 1, the function continues.
Related Information
- Local Variables
Local variables are scoped to a PAscript object. Therefore, you can only access local variables within the block of code that defines the PAscript object.
- Terminate Program Prematurely
Terminate PAscript programs prematurely with return.