Double Boolean Comparisons
From The Oxygene Language Wiki
(Redirected from Boolean Double Comparison)
This is a Language topic about Oxygene
Language Topics Introduction | Structured Overview | Grammar | Keywords | Functions
A minor but a very handy feature, comparison operators now can be used for expressions such as:
if 5 < y < 10 then ...
to test if y is between 5 and 10. This is more than just syntactic sugar as Boolean short-circuits apply and there is only a single variable to evaluate. Compare this with
if (5 < y) and (y < 10) then ...
where y would be evaluated twice if it is not less than 5 (imagine y being a property or a complex method).