blob: 1af11fa759ead4b36cc6b9d54b46ffcf6f26cc75 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
The `pop()` function removes the last element of the given source array.
Returns the removed value.
Returns `null` if the given source argment is not an array.
Throws a type exception if the given array is immuatable.
-- Testcase --
{%
let arr = [ 1, null, 3 ];
printf("%.J\n", [
// remove one element
pop(arr),
// remove a null element
pop(arr),
// invalid source
pop({ test: true })
]);
printf("%.J\n", arr);
%}
-- End --
-- Expect stdout --
[
3,
null,
null
]
[
1
]
-- End --
|