This project is read-only.
take - simple

Category:
LINQ
Description: This sample uses Take to get only the first 3 elements of the array.
Code:
let LINQ15() =
let numbers = [ 5; 4; 1; 3; 9; 8; 6; 7; 2; 0 ]

query {
for n in numbers do
take 3
} |> Seq.iter(fun n -> printfn "%d" n)

//sample output
// 5
// 4
// 1


Execution Result:
5
4
1

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

Comments

No comments yet.