Anonymous user
Arrays: Difference between revisions
Add Nu
(Add LDPL) |
imported>Brie (Add Nu) |
||
Line 6,117:
FunctionEnd
</syntaxhighlight>
=={{header|Nu}}==
<syntaxhighlight lang="nu">
let x = [1 2 3]
print $x
# Both are equivalent
print $x.1 ($x | get 1)
# Shadowing the original x
let x = $x | append 4
print $x
# Using mut
mut y = [a b c]
print $y
$y = $y | append d
print $y
</syntaxhighlight>
{{out}}
<pre>
╭───┬───╮
│ 0 │ 1 │
│ 1 │ 2 │
│ 2 │ 3 │
╰───┴───╯
2
2
╭───┬───╮
│ 0 │ 1 │
│ 1 │ 2 │
│ 2 │ 3 │
│ 3 │ 4 │
╰───┴───╯
╭───┬───╮
│ 0 │ a │
│ 1 │ b │
│ 2 │ c │
╰───┴───╯
╭───┬───╮
│ 0 │ a │
│ 1 │ b │
│ 2 │ c │
╰───┴───╯
</pre>
=={{header|Oberon-2}}==
|