Consolidate Conditional Expression

You have a sequence of conditional tests with the same result.

Combine them into a single conditional expression and extract it.

	double disabilityAmount() {
		if (_seniority < 2) return 0;
		if (_monthsDisabled > 12) return 0;
		if (_isPartTime) return 0;
		// compute the disability amount

	double disabilityAmount() {
		if (isNotEligableForDisability()) return 0;
		// compute the disability amount

For more information see page 240 of Refactoring

| Refactoring Home | | Alphabetical List |