Kotlin, Programming, Software Development, Functional Programming, Coding.
sumStartingFrom10 = numbers.fold(10) { acc, number -> acc + number } // Result: 20 Example — For instance, if you want to concatenate strings with an initial value val words = listOf("apple", "banana", "cherry") val concatenated = words.fold("Fruits:") { acc, word -> "$acc $word" } // Result: