From 96e21f612292967b9ae273e82dcd93464e55fd9c Mon Sep 17 00:00:00 2001 From: Svetlana Isakova Date: Tue, 20 Jul 2021 17:13:07 +0200 Subject: [PATCH] Simplified the solution for 'Summary 1 ex 8' as suggested in https://github.com/BruceEckel/AtomicKotlinExamples/issues/19 --- Programming Basics/Summary 1/Exercise 8/src/Task.kt | 4 +--- Programming Basics/Summary 1/Exercise 8/task-info.yaml | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/Programming Basics/Summary 1/Exercise 8/src/Task.kt b/Programming Basics/Summary 1/Exercise 8/src/Task.kt index 5d317376..1dc99c61 100644 --- a/Programming Basics/Summary 1/Exercise 8/src/Task.kt +++ b/Programming Basics/Summary 1/Exercise 8/src/Task.kt @@ -6,11 +6,9 @@ fun reverseDecimal(number: Int): Int { var result = 0 while (worker > 0) { + result *= 10 result += worker % 10 worker /= 10 - if (worker != 0) { - result *= 10 - } } return result } diff --git a/Programming Basics/Summary 1/Exercise 8/task-info.yaml b/Programming Basics/Summary 1/Exercise 8/task-info.yaml index 87678acb..becce18d 100644 --- a/Programming Basics/Summary 1/Exercise 8/task-info.yaml +++ b/Programming Basics/Summary 1/Exercise 8/task-info.yaml @@ -4,7 +4,7 @@ files: visible: true placeholders: - offset: 89 - length: 171 + length: 140 placeholder_text: TODO() - name: test/Tests.kt visible: false