Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumKotlinsealed class hierarchiesSingle-choice MCQ

Given this sealed hierarchy, what does the `when` evaluate to for the call shown?

sealed class Tree object Leaf : Tree() data class Node(val l: Tree, val r: Tree) : Tree() fun label(t: Tree) = when (t) { is Leaf -> "leaf" is Node -> "node" } val result = label(Leaf)