summaryrefslogtreecommitdiffhomepage
path: root/tests/custom/03_stdlib/47_max
blob: 69e6fb84ef14cb38b610e55c3d881cf3a1e29fd2 (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
The `max()` function returns the maximum of all given arguments.

If multiple equivalent maximum values are given (e.g. `null` and `false`
both are treated as `0` when comparing numerically), the first maximal
value is returned.

Returns the maximum value among all given arguments or `null` if no
arguments were passed.

-- Testcase --
{%
	printf("%.J\n", [
		max(),
		max(5, 1, 3, -10),
		max("foo", "bar", "xxx", "abc"),
		max(false, null, 0, NaN)
	]);
%}
-- End --

-- Expect stdout --
[
	null,
	5,
	"xxx",
	false
]
-- End --