Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

In f# I am looking for a more succint equivalent of:

myNumber >= 2 && myNumber <= 4

I imagine something like

myNumber >=< (2, 4)

Is there some kind of operation like this?

like image 370
Jordan Morris Avatar asked Jul 29 '13 03:07

Jordan Morris


1 Answers

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

let inline (>=<) a (b,c) = a >= b && a<= c
like image 147
John Palmer Avatar answered Sep 28 '22 00:09

John Palmer