kotlin reduce code example
Example: kotlin reduce
listOf(1, 2, 3).reduce { sum, element -> sum + element } // 6
val strs = listOf("a", "b", "c", "d")
println(strs.reduce { acc, string -> acc + string }) // abcd
listOf(1, 2, 3).reduce { sum, element -> sum + element } // 6
val strs = listOf("a", "b", "c", "d")
println(strs.reduce { acc, string -> acc + string }) // abcd