RosettaCodeData/Task/Test-a-function/Jq/test-a-function-1.jq
2017-09-25 22:28:19 +02:00

19 lines
224 B
Text

# Test case 1:
.
1
1
# Test case 2:
1+1
null
2
# Test case 3 (with the wrong result):
1+1
null
0
# A test case with a function definition:
def factorial: if . <= 0 then 1 else . * ((. - 1) | factorial) end; factorial
3
6