Is there a language construct in F# for testing if a number is between two other numbers (in a range)?

f#, operators, range

Solution

There is no native operator, but you could define your own one.

let inline (>=<) a (b,c) = a >= b && a<= c

Problem

I am looking for a more succinct F# equivalent of: ``` myNumber >= 2 && myNumber <= 4 ``` I imagine something like ``` myNumber >=< (2, 4) ``` Is there some kind of operation like this?

Original source

Related problems