summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/modules/isEven.js
blob: 242cddf4024de61d19380e4ed4af31d5c71bf8a0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
import { isOdd } from "isOdd.js"

export function isEven(x) {
    if (x < 0)
        throw "negative";
    if (x == 0)
        return true;
    return isOdd(x - 1);
}

assertEq(isEven(4), true);
assertEq(isOdd(5), true);