Skip to content

Commit

Permalink
tp1 solution
Browse files Browse the repository at this point in the history
  • Loading branch information
ctruchi committed Feb 6, 2025
1 parent 29a8987 commit 1f10233
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tp1/src/main/kotlin/fmt/kotlin/fundamentals/Tp1.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
}

0 comments on commit 1f10233

Please sign in to comment.