1 The `type()` function returns the type name of the given argument as 2 string. 3 4 Returns `null` if the given argument is `null` or omitted. 5 6 7 -- Testcase -- 8 {% 9 printf("%.J\n", [ 10 type(), 11 type(null), 12 type(false), 13 type(true), 14 type(123), 15 type(-0xaf), 16 type(456.789), 17 type(-456.789), 18 type([ "foo", "bar", "baz" ]), 19 type({ example: "object" }), 20 type(function() {}), 21 type((n) => n * n), 22 type(print) 23 ]); 24 %} 25 -- End -- 26 27 -- Expect stdout -- 28 [ 29 null, 30 null, 31 "bool", 32 "bool", 33 "int", 34 "int", 35 "double", 36 "double", 37 "array", 38 "object", 39 "function", 40 "function", 41 "function" 42 ] 43 -- End --
This page was automatically generated by LXR 0.3.1. • OpenWrt