0

I need to capture a value and don't know how to do it.

myData |> Seq.count

How do I capture that count? I want to be able to do an if on it or whatever.

Thanks.

2 Answers 2

4

I think you'll want Seq.length to determine the length of a sequence:

let n = {1..42} |> Seq.length
if n > 10 then printf "Too many numbers!"
Sign up to request clarification or add additional context in comments.

Comments

3

Since some collections (e.g., array) have a Length property which can be used to efficiently check for empty, I thought I'd mention, if that's what you're going for, Seq.isEmpty is what you want. Seq.length is O(n).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.