fork download
  1. object HelloWorld {
  2. def totalSelectedValues(values: List[Int],
  3. selector : Int => Boolean) = {
  4. var total = 0
  5. for( e <- values) {
  6. if (selector(e)) total +=e
  7. }
  8. total
  9. }
  10.  
  11. def main(args: Array[String]) {
  12. val listOfValues = List(1, 2, 4, 5, 6, 7, 8)
  13. println(totalSelectedValues(listOfValues, {e => true}))
  14. }
  15. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
/opt/scala/bin/scalac: line 50: /dev/null: Permission denied
spoj: The program compiled successfully, but Main.class was not found.
      Class Main should contain method: def main(args: Array[String]).
stdout
Standard output is empty