Skip to content

Commit 1f10233

Browse files
committed
tp1 solution
1 parent 29a8987 commit 1f10233

File tree

1 file changed

+9
-5
lines changed
  • tp1/src/main/kotlin/fmt/kotlin/fundamentals

1 file changed

+9
-5
lines changed

tp1/src/main/kotlin/fmt/kotlin/fundamentals/Tp1.kt

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,29 @@ class Tp1 {
55
var x = 0
66

77
fun incrementXAndReturnOldValue(): Int {
8-
return -1;
8+
return x++;
99
}
1010

1111
fun incrementXAndReturnNewValue(): Int {
12-
return -1;
12+
return ++x;
1313
}
1414

1515
fun sum(m: Int, n: Int): Int {
16-
return -1
16+
return m + n
1717
}
1818

1919
/**
2020
* n Number of bottles. Always more than 2.
2121
*/
2222
fun describeNbBottles(n: Int): String {
23-
return "";
23+
return "There are $n bottles";
2424
}
2525

2626
fun describeWithDetailNbBottles(totalBottles: Int, nbWhiteBottles: Int, nbRedBottles: Int): String {
27-
return ""
27+
return """
28+
There are $totalBottles bottles :
29+
- $nbWhiteBottles bottles of white
30+
- $nbRedBottles bottles of red
31+
""".trimIndent()
2832
}
2933
}

0 commit comments

Comments
 (0)