Here, we must make a distinction between single, so called scalar! values, such as numbers, dates, chars, and so on (See The type system section in Chapter 3, Using Words, Values, and Types), and all other values:
- Scalar values are passed by value, which means that a copy of the value is sent to the function
- Other values are passed by reference, which means that a reference to the value is sent to the function
The consequence of this is that scalar values cannot be changed by a function, whereas other values (such as series and objects) are changed. This can be seen in the following code snippet:
;-- see Chapter06/function-attributes.red:passing-ref: function [data][ append data 108]data: [2 3 7 42]passing-ref datadata ...