Home

IF ... ELSEIF constructs should end with ELSE clauses

Rule description

  • IF ... ELSEIF constructs should end with ELSE clauses

 

Non-compliant Code Example

function string TestFunctionCall (string cnt)

if cnt = 1 then
	messagebox('cnt = 1')
elseif cnt = 2 then 
	messagebox('cnt = 2')
end if //Non compliant code (ELSE clause is missing)

return cnt

end function

Compliant Code Example

function string TestFunctionCall (string cnt)

if cnt = 1 then
	messagebox('cnt = 1')
elseif cnt = 2 then 
	messagebox('cnt = 2')
else //Compliant code
    messagebox('cnt > 2')
end if 

return cnt

end function
Visual Expert 2020
 VEPBRULE63