Is there any operator or trick for such operation? Or is it necessary to use
if(5<i && i<10)
?
See Question&Answers more detail:osIs there any operator or trick for such operation? Or is it necessary to use
if(5<i && i<10)
?
See Question&Answers more detail:osYou cannot chain inequalities. You can, however, define a static boolean method isInRange(value, low, high)
that will perform such a check.
Some other languages, like Python or Icon, allow this notation.