Call-by-value
The calling program transfers only the value of a variable to the subprogram on a call-by-value
parameter transfer. Thus the subprogram is not given direct access to the variable. In this way,
only the value visible in the subprogram is modified when the parameter value is changed. The
value of the variables defined in the calling program remains unchanged. As a consequence,
the call-by-value parameter transfer does not affect the calling program.
Old values valid
New values
valid
New value
assignment
LENGTH=20
WIDTH=15
Subprogram
Value assignment
LENGTH=12
WIDTH=10
Main program
LENGTH, WIDTH
Syntax
PROC <program name> (<parameter type> <parameter
name>=<init_value>, ...)
Note
Up to 127 parameters can be transferred.
Meaning
PROC: Definition operation at the beginning of a program
<program name>: Name of the program
<parameter type>: Data type of the parameter (e.g. REAL, INT, BOOL)
<parameter name>: Name of the parameter
<init_value>: Optional value for the initialization of the parameter (optional)
If no parameter is specified when calling the subprogram, the param‐
eter is assigned the initialization value.
Work preparation
3.2 Subprogram technique
NC programming
Programming Manual, 12/2019, 6FC5398-2EP40-0BA0 497