fork download
  1. object Main extends App {
  2. class IntImprovement {
  3. var int = 0;
  4. def this(j: Int) = {this(); int = j;}
  5. def i() = int;
  6. def i=(j: Int) = {int = j;}
  7. def ++() = this.i=(i+1);
  8. def --() = i-=1;
  9. def +=(j: Int) = {i = i+j;}
  10. def -=(j: Int) = i=i-j;
  11. def *=(j: Int) = i=i*j;
  12. def /=(j: Int) = i=i/j;
  13. def %=(j: Int) = i=i%j;
  14. }
  15. //Turns all Ints into IntImprovements
  16. implicit def int2Improve(i: Int) = new IntImprovement(i);
  17. //and back
  18. implicit def improve2Int(i: IntImprovement) = i.i;
  19.  
  20. override def main(args: Array[String]) {
  21. var x = 5;
  22. x++;
  23. println(x);
  24. }
  25.  
  26. }
Compilation error #stdin compilation error #stdout 0.39s 382016KB
stdin
Standard input is empty
compilation info
/opt/scala/bin/scalac: line 50: /dev/null: Permission denied
Main.scala:6: error: ';' expected but '=' found.
  	def i=(j: Int) = {int = j;}
                       ^
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