mirror of
https://github.com/MorizzG/MLox.git
synced 2025-12-06 04:22:41 +00:00
13 lines
No EOL
224 B
Lox
13 lines
No EOL
224 B
Lox
{
|
|
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);
|
|
} |