Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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