Created
August 21, 2021 13:07
-
-
Save magdamiu/d7bd569c5c34c0cd33454d90d12b971a to your computer and use it in GitHub Desktop.
Clean Code with Kotlin by Magda Miu - Error Handling 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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