VOOZH about

URL: https://www.geeksforgeeks.org/scala/scala-set-sum-method-with-example/

⇱ Scala Set sum() method with example - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Scala Set sum() method with example

Last Updated : 18 Oct, 2019
The sum() method is utilized to find the sum of all the elements of the set.
Method Definition: def sum: A Return Type: It returns the sum of all the elements of the set.
Example #1:
Output:
10
Example #2:
Output:
29
Comment

Explore