Confusing use of numeric test operators
objectscriptQuality release
Id
OS0041
Rule type
Code Smell
Severity
Info
Info
SQALE characteristic
- Maintainability
- Readability
Remediation function
Constant/issue
Remediation cost
5min
Given two variables n1 and n2, and assuming both variables have a numeric value, there are two ways to check whether one is greater than, or equal, to the other:
// Old way; literally, "n1 not strictly less than n2" n1 '< n2 // New way n1 >= n2
For readability reasons, the second form is preferred. Similarly, you will want to use <= instead of '> to test whether a number is less than, or equal, to another.