Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
|
|
@ -0,0 +1,20 @@
|
|||
// version 1.1
|
||||
|
||||
fun divideByZero(x: Int, y:Int): Boolean =
|
||||
try {
|
||||
x / y
|
||||
false
|
||||
} catch(e: ArithmeticException) {
|
||||
true
|
||||
}
|
||||
|
||||
fun main(args: Array<String>) {
|
||||
val x = 1
|
||||
val y = 0
|
||||
if (divideByZero(x, y)) {
|
||||
println("Attempted to divide by zero")
|
||||
} else {
|
||||
@Suppress("DIVISION_BY_ZERO")
|
||||
println("$x / $y = ${x / y}")
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue