fork download
  1. object Main extends App {
  2. var x = List[() => Unit]
  3. for( i <- 1 to 3){
  4. var number = i
  5. x ::= ( () => {System.out.println("" + number)})}
  6. for(function <-x){
  7. function()
  8. }
  9. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
compilation info
Main.scala:2: error: missing arguments for method apply in object List;
follow this method with `_' if you want to treat it as a partially applied function
    var x = List[() => Unit]
                ^
one error found
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