Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumKotlintailrec functionsSingle-choice MCQ

Both functions are marked tailrec and each one's recursive call is the last operation. What does the compiler actually do?

tailrec fun isEven(n: Int): Boolean = if (n == 0) true else isOdd(n - 1) tailrec fun isOdd(n: Int): Boolean = if (n == 0) false else isEven(n - 1)