fork download
  1. def doIt(l : MyList) : Int = {
  2. l match {
  3. case Nil() =>
  4. print(0)
  5. 0
  6. case Cons(v,t) =>
  7. print(v + doIt(t))
  8. v
  9. }
  10. }
  11.  
  12. val ll = Cons(1,Cons(2,Cons(3,Nil())))
  13. val k = doIt(ll)
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.scala:1: error: expected class or object definition
def doIt(l : MyList) : Int = {
^
Main.scala:12: error: expected class or object definition
val ll = Cons(1,Cons(2,Cons(3,Nil())))
^
Main.scala:13: error: expected class or object definition
val k = doIt(ll)
^
three errors found
stdout
Standard output is empty