This project is read-only.
Basic Iteration

Category:
Sequences
Description: This sample demonstrates basic sequence iteration.
Code:
let SequenceExample2() =
let squaresSeq = seq {for i in 1..5 -> i*i}
// iterating a sequence in this manner can cause exceptions/errors with large sequences!
printf "squaresSeq = "
for i in squaresSeq do printf "%d " i

//--------------------------------------------------------

Execution Result:
squaresSeq = 1 4 9 16 25 

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

Comments

No comments yet.