Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (myList.isEmpty) return x > 5
- if x < 0 return false
- if (myList.head == "+") return foo()
- if (myList.head == "-") return bar()
- if(x > 0) {
- myList.headOption match {
- case Some("+") => foo()
- case Some("-") => bar()
- case None => x > 5
- } else false
- myList match {
- case Nil => x > 5
- case _ if x < 0 => false
- case "+" :: _ => foo()
- case "-" :: _ => bar()
- }
- def sampleFunction: Boolean =
- lst match {
- case Nil => x > 5
- case _ if (x < 0) => false
- case "+" :: _ => true
- case "-" :: _ => false
- case _ => true // return something if nothing matches
- }
Add Comment
Please, Sign In to add comment