The rule is applied whenever the conditional operator If Then ElseIf contains one or more blocks **ElseIf **. After block ElseIf must be followed by block Else.
The requirement to the final blockElse - it protective programming. Such constructions are resistant to possible changes and do not mask possible errors.
The construct Else must either take appropriate action or contain a suitable comment as to why no action is being taken.
Incorrect:
If TypeOf(InputParameter) = Type("Structure") Then
Result = FillByStructure(InputParameter);
ElsIf TypeOf(InputParameter) = Type("Document.Ref.MajorDocument") Then
Result = FillByDocument(InputParameter);
EndIf;
Correct:
If TypeOf(InputParameter) = Type("Structure") Then
Result = FillByStructure(InputParameter);
ElsIf TypeOf(InputParameter) = Type("Document.Ref.MajorDocument") Then
Result = FillByDocument(InputParameter);
Else
Raise "Parameter of invalid type passed";
EndIf;