Skip to content

Instantly share code, notes, and snippets.

@tristaaan
Created May 1, 2015 05:19
Show Gist options
  • Save tristaaan/ccf818d0cf8aa077e516 to your computer and use it in GitHub Desktop.
Save tristaaan/ccf818d0cf8aa077e516 to your computer and use it in GitHub Desktop.
extension Array{
func every(fn: (T)->Bool) -> Bool{
var out = true
for i in self {
out = out && fn(i);
}
return out
}
func some(fn: (T) -> Bool) -> Bool{
var out = false
for i in self {
out = out || fn(i);
}
return out
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment