This project is read-only.
head - Condition

Category:
LINQ
Description: This sample uses First to find the first element in the array that starts with 'o'.
Code:
let LINQ25() =
let strings = [ "zero"; "one"; "two"; "three"; "four"; "five"; "six"; "seven"; "eight"; "nine" ]

let startsWithO =
query {
for s in strings do
where (s.[0] = 'o')
head
}
printfn "A string starting with 'o': %s" startsWithO

//sample output
// A string starting with 'o': one

Execution Result:
A string starting with 'o': one

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

Comments

No comments yet.