The other day I saw this on a pull request:
I find this a bit jarring to read and avoid it in my code. Instead I prefer something like the following:
This predicate, closer to the mathematical predicate, reads better to me. It's easier to see that
now needs to be in between two limits. This syntax is allowed in some languages such as Python.
But many other languages don't allow this, so I go for the next best thing:
And now… it was only while writing this that I realised: sometimes there is another great alternative, modelled after the following mathematical predicate:
This can be translated directly to some languages too, such as this Ruby example: