Reduce Scala

[Solved] Reduce Scala | Scala - Code Explorer | yomemimo.com
Question : reduce scala

Answered by : yxyfer

val l = List(2, 5, 3, 6, 4, 7)
// returns the largest number from the collection
l.reduce((x, y) => x max y)

Source : https://www.geeksforgeeks.org/scala-reduce-function/ | Last Update : Sat, 16 Apr 22

Answers related to reduce scala

Code Explorer Popular Question For Scala