Skip to content

Instantly share code, notes, and snippets.

@magdamiu
Created August 21, 2021 13:07
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 magdamiu/d7bd569c5c34c0cd33454d90d12b971a to your computer and use it in GitHub Desktop.
Save magdamiu/d7bd569c5c34c0cd33454d90d12b971a to your computer and use it in GitHub Desktop.
Clean Code with Kotlin by Magda Miu - Error Handling 1
fun computeSqrt(number: Double): Double {
if(number >= 0) {
return Math.sqrt(number)
} else {
throw RuntimeException("No negative please")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment