1
1
Fork 0

refactor(Programming Basics - if Expressions - Exercise 2): The condition for the modulus in the reference solution adjusted gt -> ge

The condition in the if clause in the referrence solution is adjusted to
avoid negating the zero case:
if (number > 0) -> if (number >=0)

Closes https://youtrack.jetbrains.com/issue/EDC-415
This commit is contained in:
Igor 2021-05-27 11:35:34 +03:00
parent 184b550de0
commit 5f624457f7
2 changed files with 2 additions and 2 deletions

View File

@ -2,7 +2,7 @@
package ifExpressionsExercise2
fun abs(number: Int): Int =
if (number > 0) number else -number
if (number >= 0) number else -number
fun main() {
println(abs(-19)) // 19

View File

@ -4,7 +4,7 @@ files:
visible: true
placeholders:
- offset: 88
length: 35
length: 36
placeholder_text: TODO()
- name: test/Tests.kt
visible: false