File tree Expand file tree Collapse file tree 1 file changed +9
-5
lines changed
tp1/src/main/kotlin/fmt/kotlin/fundamentals Expand file tree Collapse file tree 1 file changed +9
-5
lines changed Original file line number Diff line number Diff 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}
You can’t perform that action at this time.
0 commit comments