maxBy - Simple

Category:
LINQ
Description: This sample uses Max to get the highest number in an array.
Code:
let LINQ34() =
let numbers = [ 5; 4; 1; 3; 9; 8; 6; 7; 2; 0 ]
let maxNum =
query {
for n in numbers do
maxBy n
}
printfn "The maximum number is %A." maxNum

//sample output
// The maximum number is 9.

Execution Result:
The maximum number is 9.

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

Comments

No comments yet.