PML Procedures
- Last UpdatedNov 10, 2025
- 1 minute read
A PML Procedure is a PML Function that does not return a result.
A function is defined as a procedure by omitting the data type at the end of the define function statement:
define function !!Area( !Length is REAL, !Width is REAL,
!Result is REAL)
!Result = !Length * !Width
endfunction
Here we are using an output argument, !Result, to return the result rather than using a function return value.
The arguments to the !!Area procedure can be set as follows, and then the procedure invoked with the call command.
!SurfaceArea = REAL()
!Partlength = 7
!PartWidth = 6
call !!Area(!PartLength, !PartWidth, !SurfaceArea)
There will be an error if you attempt to assign the result of a PML Procedure because there is no return value to assign. So, for example you can say:
call !!Area(!PartLength, !PartWidth, !SurfaceArea)
!Answer = !SurfaceArea
But you cannot say:
|
!Answer = !!Area(!PartLength, !PartWidth, !SurfaceArea) |
$* WRONG |
The ( ) parentheses after the name of a procedure or function must always be present — even for procedures that do not need arguments:
define function !!initialize()
!TotalWeight = 0
!!MaxWeight = 0
endfunction
call !!initialize()
Although the call keyword is strictly speaking optional, its use is recommended with procedures.
Note: As well as procedures, you can invoke a PML Function that has a return value using call, in which case the function result value is discarded.