0

I have a simple if - else construct that operates with data grid filterind. Like this:

if (_r1 <= _r3 && _r3 <= _r2) {
   return true;
}
else {
   return false;
}

where _r1, _r2, _r3 and numbers. It has both true and false. Is it possible to rewrite this construction that it will has only for example true branch and will go to the else branch by default?

P.S. (if ... ? ... : ...) is not what I want.

2 Answers 2

7

Use:

return _r1 <= _r3 && _r3 <= _r2;
Sign up to request clarification or add additional context in comments.

Comments

2
if (_r1 <= _r3 && _r3 <= _r2) {
   return true;
}
return false;

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.