Sum

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.147.46.80