Pointers and references: Difference between revisions
→{{header|Wren}}: Clarified the distinction between value and reference types.
(Added Wren) |
(→{{header|Wren}}: Clarified the distinction between value and reference types.) |
||
Line 1,659:
References are always implicit - you have to remember which types are reference types and which are value types.
Of the built-in classes only Num
The following example illustrates the difference by passing both value and reference type parameters to a function. Note that in Wren parameters are always passed by value.
<lang ecmascript>// This function takes a string (behaves like a value type) and a list (reference type).
// The value and the reference are copied to their respective parameters.
var f = Fn.new { |s, l|
|