fork download
  1. import scala.io.Source
  2.  
  3. object LongLines {
  4. def processFile(filename: String, width: Int) {
  5. def processLine(line: String) {
  6. if (line.length > width) {
  7. println(filename +": "+ line)
  8. println(source)
  9. }
  10. }
  11.  
  12. val source = Source.fromFile(filename)
  13. for (line <- source.getLines())
  14. processLine(line)
  15. }
  16. }
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.scala:8: error: forward reference extends over definition of value source
				println(source)
                                        ^
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