rlox/interpreter/tests/lox/function/local_mutual_recursion.lox

13 lines
224 B
Lox
Raw Permalink Normal View History

2024-09-01 19:15:55 +02:00
{
fun isEven(n) {
if (n == 0) return true;
return isOdd(n - 1); // expect runtime error: Undefined variable 'isOdd'.
}
fun isOdd(n) {
if (n == 0) return false;
return isEven(n - 1);
}
isEven(4);
}