This returns the sum of all numbers in the collection:
val numbers = listOf(1, 2, 3, 4, 5)
val sum = numbers.sum()
Note that the min, max and sum functions can only be used on collections with number types.
This returns the sum of all numbers in the collection:
val numbers = listOf(1, 2, 3, 4, 5)
val sum = numbers.sum()
Note that the min, max and sum functions can only be used on collections with number types.
3.147.46.80