Home

EXIT should not be used in loops

Rule description

  • EXIT should not be used in loops

 

Non-compliant Code Example

function int TestFunctionCall (int cnt)

DO WHILE cnt <= 15
    
    IF cnt < 0 THEN
        EXIT; //Non compliant code (EXIT statement is used within loop)
    END IF;
      
      cnt = cnt - 1
LOOP

return cnt;

end function

Compliant Code Example

function cnt TestFunctionCall (int cnt)

DO UNTIL  (cnt <= 15 AND cnt >= 0)
      cnt = cnt - 1
LOOP 

return cnt;

end function
Visual Expert 2020
 VEPBRULE55