package com.example.puzzles.types.union sealed interface Creature object Dragon : Creature object Unicorn : Creature object Yeti : Creature fun main() { val mysteryFootprints: Yeti? = null when (mysteryFootprints) { is Dragon? -> println("Looks like the claw-marks of a huge dragon.") is Unicorn? -> println("I see the hoof-prints of a magical unicorn.") is Yeti? -> println("These huge footprints prove the yeti is real!") null -> println("There aren't any footprints.") } }