Is there any operator or trick for such operation? Or is it necessary to use
if(5<i && i<10)
?
You 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. Perhaps the parameters should be ordered as isInRange(low, value, high) e.g. isInRange(5, i, 10) .
Inequality. The inequality operator is != (an exclamation point, followed by an equal sign). It is a binary operator: exprleft !=
You 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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With