We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 3cc58af commit 1f0f448Copy full SHA for 1f0f448
tp9/src/main/kotlin/fmt/kotlin/fundamentals/Cellar.kt
@@ -1,5 +1,7 @@
1
package fmt.kotlin.fundamentals
2
3
+import fmt.kotlin.fundamentals.WineColor.RED
4
+
5
data class Cellar(
6
val bottles: List<Bottle>
7
) {
@@ -9,5 +11,11 @@ data class Cellar(
9
11
}
10
12
13
- fun describeRedBottles() = ""
14
+ fun describeRedBottles() = bottles.joinToString("\n") {
15
+ it.takeIf { it.color == RED }
16
+ ?.let {
17
+ "Bouteille de ${it.name} de ${it.year}"
18
+ }
19
+ ?: "Bouteille de blanc"
20
21
0 commit comments