From 1f10233782355882fbb50553786fc302cee3380f Mon Sep 17 00:00:00 2001 From: ctruchi Date: Thu, 6 Feb 2025 09:52:23 +0400 Subject: [PATCH] tp1 solution --- tp1/src/main/kotlin/fmt/kotlin/fundamentals/Tp1.kt | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/tp1/src/main/kotlin/fmt/kotlin/fundamentals/Tp1.kt b/tp1/src/main/kotlin/fmt/kotlin/fundamentals/Tp1.kt index 5a64e08..d1edc2f 100644 --- a/tp1/src/main/kotlin/fmt/kotlin/fundamentals/Tp1.kt +++ b/tp1/src/main/kotlin/fmt/kotlin/fundamentals/Tp1.kt @@ -5,25 +5,29 @@ class Tp1 { var x = 0 fun incrementXAndReturnOldValue(): Int { - return -1; + return x++; } fun incrementXAndReturnNewValue(): Int { - return -1; + return ++x; } fun sum(m: Int, n: Int): Int { - return -1 + return m + n } /** * n Number of bottles. Always more than 2. */ fun describeNbBottles(n: Int): String { - return ""; + return "There are $n bottles"; } fun describeWithDetailNbBottles(totalBottles: Int, nbWhiteBottles: Int, nbRedBottles: Int): String { - return "" + return """ + There are $totalBottles bottles : + - $nbWhiteBottles bottles of white + - $nbRedBottles bottles of red + """.trimIndent() } } \ No newline at end of file