count - Simple

Category:
LINQ
Description: This sample uses Count to get the number of unique factors of 300.
Code:
let LINQ28() =
let factorsOf300 = [2;2;3;5;5]

let uniqueFactors =
query {
for n in factorsOf300 do
count
}
printfn "There are %A unique factors of 300." uniqueFactors

//sample output
// There are 3 unique factors of 300.


Execution Result:
There are 5 unique factors of 300.

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

Comments

No comments yet.