Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- val ls = List(0, -1, 2, -2)
- var removeNegative = List[Int]()
- def removeNegative(ls: List[Int]): Int = ls match {
- case Nil => 0
- case l::for(ls <- ls){
- var removeNegative = List[Int]()
- if(ls >= 0){
- removeNegative = removeNegative :+ ls
- }
- }
- return removeNegative
- }
- println(removeNegative(ls)
- ScalaFiddle.scala:7: error: illegal start of simple pattern
- case l::for(ls <- ls){
- ^
- ScalaFiddle.scala:16: error: '=>' expected but '}' found.
- }
- ^
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement