Pointers and references: Difference between revisions
Content added Content deleted
imported>Acediast (→{{header|COBOL}}: Syntax highlighting.) |
m (→{{header|Wren}}: Changed to Wren S/H) |
||
Line 2,168: | Line 2,168: | ||
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. |
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. |
||
<syntaxhighlight lang=" |
<syntaxhighlight lang="wren">// 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. |
// The value and the reference are copied to their respective parameters. |
||
var f = Fn.new { |s, l| |
var f = Fn.new { |s, l| |