Skip to main content

Practice ยท 1 of 3

First or Default

CHALLENGE
Difficulty: intermediate+25 XP

Write firstOr(items, fallback) โ€” RETURN the first element or fallback when the list is empty. The RETURNED value must have the SAME type relationship as the input (works for any element kind, no coercion).

Back to lesson: Practice: Generics โ€” Practice