---
title: "Avoid Creating Deeply Nested If-Then Statements"
description: "Impact Area Manageability Severity Medium Affected Element Apex Class Rule ID **SF-0007** ## Impact Deeply nested if-else statements can be confusing and complicate debugging. ## Remediation Refactor the code to reduce its complexity. ### Time to fix 45 min"
url: "https://community-staging.qualityclouds.com/qcdocs/qc/pmd-rules/avoid-creating-deeply-nested-if-then-statements/"
updated: "2025-03-21"
category: PMD Rules
---

# Avoid Creating Deeply Nested If-Then Statements

Impact Area

Manageability

           Severity

Medium

           Affected Element

Apex Class

Rule ID

**SF-0007**

## Impact

Deeply nested if-else statements can be confusing and complicate debugging.

## Remediation

Refactor the code to reduce its complexity.

### Time to fix

45 min
