alguidelines/content/docs/BestPractices/blank-lines-when-not-to-use/index.md
2022-05-06 09:00:32 +02:00

1.2 KiB

title tags categories
When not to use Blank Lines
AL
Readability
Best Practice

Do not use blank lines:

  • at the beginning or end of any functions (after begin and before end)
  • inside multiline expressions

Example 1

Bad code

procedure MATRIX_OnDrillDown(MATRIX_ColumnOrdinal: Integer);
begin

    SetupDrillDownCol(MATRIX_ColumnOrdinal);
    DrillDown(false, ValueType);

end;

Good code

procedure MATRIX_OnDrillDown(MATRIX_ColumnOrdinal: Integer);
begin
    SetupDrillDownCol(MATRIX_ColumnOrdinal);
    DrillDown(false, ValueType);
end;

Example 2

Bad code

if NameIsValid and

    Name2IsValid
then

Good code

if NameIsValid and
    Name2IsValid
then

Tips

The AZ AL Dev Tools/AL Code Outline extension adds two new commands to Visual Studio Code to remove empty duplicate lines.

  • Remove Empty Lines from the Active Editor : removes empty duplicate lines from the current editor
  • Remove Empty Lines from the Active Project : removes empty duplicate lines from the current project