From 5f624457f71e164c2203faf0ff10af92757d3ecc Mon Sep 17 00:00:00 2001 From: Igor Date: Thu, 27 May 2021 11:35:34 +0300 Subject: [PATCH] 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 --- Programming Basics/if Expressions/Exercise 2/src/Task.kt | 2 +- Programming Basics/if Expressions/Exercise 2/task-info.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Programming Basics/if Expressions/Exercise 2/src/Task.kt b/Programming Basics/if Expressions/Exercise 2/src/Task.kt index 0bf6395c..4f694cc7 100644 --- a/Programming Basics/if Expressions/Exercise 2/src/Task.kt +++ b/Programming Basics/if Expressions/Exercise 2/src/Task.kt @@ -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 diff --git a/Programming Basics/if Expressions/Exercise 2/task-info.yaml b/Programming Basics/if Expressions/Exercise 2/task-info.yaml index 6f1db126..49697f47 100644 --- a/Programming Basics/if Expressions/Exercise 2/task-info.yaml +++ b/Programming Basics/if Expressions/Exercise 2/task-info.yaml @@ -4,7 +4,7 @@ files: visible: true placeholders: - offset: 88 - length: 35 + length: 36 placeholder_text: TODO() - name: test/Tests.kt visible: false