Added Sequence.any as complement to Sequence.all

This commit is contained in:
Thorbjørn Lindeijer
2015-03-01 23:14:32 +01:00
parent e72eedc6f5
commit 8f985847d4
6 changed files with 40 additions and 2 deletions
+10
View File
@@ -0,0 +1,10 @@
var a = [1, 2, 3]
var b = a.any {|x| x > 3 }
IO.print(b) // expect: false
var d = a.any {|x| x > 1 }
IO.print(d) // expect: true
var e = [].any {|x| true }
IO.print(e) // expect: false
+1
View File
@@ -0,0 +1 @@
IO.print([1, 2, 3].any {|x| "truthy" }) // expect: true
+1
View File
@@ -0,0 +1 @@
[1, 2, 3].any("string") // expect runtime error: String does not implement 'call(_)'.