Advertisement
Guest User

Untitled

a guest
Sep 22nd, 2014
191
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. scala> val l = 1 to 10
  2. l: scala.collection.immutable.Range.Inclusive = Range(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
  3.  
  4. scala> l.forall(x => x > 0)
  5. res0: Boolean = true
  6.  
  7. scala> l.forall(x => x > 1)
  8. res1: Boolean = false
  9.  
  10. scala> l.exists(x => x < 1)
  11. res2: Boolean = false
  12.  
  13. scala> l.exists(x => x < 2)
  14. res3: Boolean = true
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement