Skip to content

Instantly share code, notes, and snippets.

@le0nidas
Last active March 8, 2020 19:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save le0nidas/9133aae3e294b00d9b0829dc8973e49a to your computer and use it in GitHub Desktop.
Save le0nidas/9133aae3e294b00d9b0829dc8973e49a to your computer and use it in GitHub Desktop.
sealed class PhoneNumber
object InvalidPhoneNumber : PhoneNumber()
data class ValidPhoneNumber(val value: String) : PhoneNumber() {
init {
require(value.isNotEmpty()) { "the number cannot be empty" }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment