Jensen's Device: Difference between revisions
Content added Content deleted
m (→{{header|Sidef}}: updated output) |
m (→{{header|Wren}}: Changed to Wren S/H) |
||
Line 1,918: | Line 1,918: | ||
=={{header|Wren}}== |
=={{header|Wren}}== |
||
As Wren doesn't support call by name, call by reference nor pointers we need to 'box' the global numeric variable 'i' and use a function for 'term' to simulate Jensen's device. This works because all user defined types are reference types and functions can capture external variables. |
As Wren doesn't support call by name, call by reference nor pointers we need to 'box' the global numeric variable 'i' and use a function for 'term' to simulate Jensen's device. This works because all user defined types are reference types and functions can capture external variables. |
||
<syntaxhighlight lang=" |
<syntaxhighlight lang="wren">class Box { |
||
construct new(v) { _v = v } |
construct new(v) { _v = v } |
||
v { _v } |
v { _v } |
||
Line 1,943: | Line 1,943: | ||
5.1873775176396 |
5.1873775176396 |
||
</pre> |
</pre> |
||
=={{header|Yabasic}}== |
=={{header|Yabasic}}== |