Constants as Function Arguments
- Last UpdatedOct 24, 2022
- 1 minute read
Passing a constant as a function argument, such as a STRING in quotes, means the argument is read only and cannot be assigned a new value. So if you define a function:
define function !!ChangeString( !Argument is STRING)
!Argument = 'New Value'
endfunction
The following will change the value of !S:
!S = ‘Old Value’
!!ChangeString ( !S )
However, the following will result in a PML error message because the value passed to the function as an argument is a CONSTANT STRING value which cannot be modified.
|
!!ChangeString ( 'OldValue' ) |
$* WRONG |