# Unnecessary ELSE

##### Tags:

- C/AL
- Readability

##### Categories:

- Best Practice

ELSE should not be used when the last action in the THEN part is an EXIT, BREAK, SKIP, QUIT, ERROR.

Bad code

    IF IsAdjmtBinCodeChanged THEN
        ERROR(AdjmtBinCodeChangeNotAllowedErr,...)
    ELSE
        ERROR(BinCodeChangeNotAllowedErr,...);

Good code

    IF IsAdjmtBinCodeChanged THEN
        ERROR(AdjmtBinCodeChangeNotAllowedErr,...)
    ERROR(BinCodeChangeNotAllowedErr,...);

Last modified February 24, 2022: Added tags & categories + cleanup (5ee04366) by waldo1001