Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
sealed class Name constructor(
val value: String
) {
object UnknownName : Name("")
class KnownName(value: String) : Name(value)
companion object {
fun of(value: String): Name {
return if (value.length in (2..25))
KnownName(value) else
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment