Skip to content

Instantly share code, notes, and snippets.

@leonardoaramaki
Created June 9, 2017 16:26
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 leonardoaramaki/6f220036d7c0accc69554ec30cb874f9 to your computer and use it in GitHub Desktop.
Save leonardoaramaki/6f220036d7c0accc69554ec30cb874f9 to your computer and use it in GitHub Desktop.
fun fail(message: String) {
throw IllegalStateException(message)
}
….
val user: User = getUser() ?: fail("User not found!")
println("Hello, ${user.name}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment