Skip to content

Commit

Permalink
tp9 step 2 solution
Browse files Browse the repository at this point in the history
  • Loading branch information
ctruchi committed Feb 14, 2025
1 parent 3cc58af commit 1f0f448
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tp9/src/main/kotlin/fmt/kotlin/fundamentals/Cellar.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package fmt.kotlin.fundamentals

import fmt.kotlin.fundamentals.WineColor.RED

data class Cellar(
val bottles: List<Bottle>
) {
Expand All @@ -9,5 +11,11 @@ data class Cellar(
}
}

fun describeRedBottles() = ""
fun describeRedBottles() = bottles.joinToString("\n") {
it.takeIf { it.color == RED }
?.let {
"Bouteille de ${it.name} de ${it.year}"
}
?: "Bouteille de blanc"
}
}

0 comments on commit 1f0f448

Please sign in to comment.