[ Back ]
All parameters are normally sent by their values to sub programs. For large arrays this could get pretty slow, as the entire arrays needs to be copied into the local parameters at every call. Another problem is that you might need a sub program that returns two variables of different types – in that case you can't return the values as an array.
When you have a parameter that is declared to be of a reference type, the variable from the caller isn't copied to the local parameter. Instead the parameter becomes a pointer to the actual variable that was sent to the sub program. If you change such a parameter inside the sub program, the value of the variable outside the sub program is also changed.
You set a parameter to be of a reference type by adding & in front of the parameter name. Ex:
procedure Dummy(normal_int, &ref_to_int_array)
ref_to_int_array = [normal_int, 19, 27]
[ Back ]