iex
enum MyEnum { FOO, BAR constructor(string): MyEnum? { when (string) "x" -> FOO, "y" -> BAR, else -> null } }