This project is read-only.
minBy - Projection

Category:
LINQ
Description: This sample uses Min to get the length of the shortest word in an array.
Code:
let LINQ33() =
let words = ["cherry"; "apple"; "blueberry"]
let shortestWord =
query {
for w in words do
minBy w.Length
}
printfn "The shortest word is %A characters long." shortestWord


//sample output
// The shortest word is 5 characters long.


Execution Result:
The shortest word is 5 characters long.

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

Comments

No comments yet.