Inspectopedia
 
2024.3

Two comparisons should be converted to a range check

Info
New
Last modified: 03 December 2024

Reports two consecutive comparisons that can be converted to a range check.

Checking against a range makes code simpler by removing test subject duplication.

Example:

The quick-fix replaces the comparison-based check with a range one: