Home

IF statements should not be nested too deeply

Rule description

  • IF statements should not be nested too deeply

 

Non-compliant Code Example

function string TestFunctionCall (string cnt)

IF x > 1 THEN 
     IF x > 2 THEN 
	    IF x > 3 THEN 
		    IF x > 4 THEN  //Non compliant code (Nested loop should be less then 4)
			    IF x > 5 THEN //Non compliant code (Nested loop should be less then 4)
				    cnt = "x > 5"
			    END IF;
            END IF;
        END IF;
     END IF;
 END IF;

return cnt

end function

Compliant Code Example

function string TestFunctionCall2 (string cnt)

IF x > 5 THEN //Compliant code
		cnt = "x > 5"
	END IF;

return cnt

end function
Visual Expert 2020
 VEPBRULE34