Not a function is evenmodified by a logical NOT, but NOT is applied to the result of calling the function evenwith n - 1. Not 4 is returned, but !(even(4)).
If we simplify the function
function even(n) { return n==0 || !even(n-1); }
we get the following extension of your call:
even(5)
5==0 || !even(5-1)
false
Bergi source
share