exists - Simple

Category:
LINQ
Description: This sample uses Any to determine if any of the words in the array contain the substring 'ei'.
Code:
let LINQ13() =
let words = ["believe"; "relief"; "receipt"; "field"]
let iAfterE =
query {
for w in words do
exists (w.Contains("ei"))
}
printfn "There is a word that contains in the list that contains 'ei': %A" iAfterE

//sample output
// There is a word that contains in the list that contains 'ei': true


Execution Result:
There is a word that contains in the list that contains 'ei': true

Last edited Sep 14, 2011 at 1:44 AM by ttliu2000, version 1

Comments

No comments yet.