In high school, when you want to indicate x is between 0 and 5, you wrote:
0 < x < 5
.
In programming, you end up with:
if ( 0 < x && 5 > x )
if ( x > 0 && x < 5 )
if ( 0 < x &&
5 > x )
Where it is hard to understand that x should be in the interval [0, 5].
Personally, I always write it like this:
if ( 0 < x && x < 5 )
Top comments (0)