updated blank lines
This commit is contained in:
parent
5652ea8c5d
commit
afc1d64ad6
2 changed files with 18 additions and 122 deletions
|
|
@ -1,53 +0,0 @@
|
||||||
---
|
|
||||||
title: "When not to use Blank Lines"
|
|
||||||
tags: ["AL","Readability"]
|
|
||||||
categories: ["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
|
|
||||||
|
|
||||||
```al
|
|
||||||
procedure MATRIX_OnDrillDown(MATRIX_ColumnOrdinal: Integer);
|
|
||||||
begin
|
|
||||||
|
|
||||||
SetupDrillDownCol(MATRIX_ColumnOrdinal);
|
|
||||||
DrillDown(false, ValueType);
|
|
||||||
|
|
||||||
end;
|
|
||||||
```
|
|
||||||
|
|
||||||
### Good code
|
|
||||||
|
|
||||||
```al
|
|
||||||
procedure MATRIX_OnDrillDown(MATRIX_ColumnOrdinal: Integer);
|
|
||||||
begin
|
|
||||||
SetupDrillDownCol(MATRIX_ColumnOrdinal);
|
|
||||||
DrillDown(false, ValueType);
|
|
||||||
end;
|
|
||||||
```
|
|
||||||
|
|
||||||
## Example 2
|
|
||||||
|
|
||||||
### Bad code
|
|
||||||
|
|
||||||
```al
|
|
||||||
if NameIsValid and
|
|
||||||
|
|
||||||
Name2IsValid
|
|
||||||
then
|
|
||||||
```
|
|
||||||
|
|
||||||
### Good code
|
|
||||||
|
|
||||||
```al
|
|
||||||
if NameIsValid and
|
|
||||||
Name2IsValid
|
|
||||||
then
|
|
||||||
```
|
|
||||||
|
|
@ -1,48 +1,38 @@
|
||||||
---
|
---
|
||||||
title: "Avoid too many blank lines"
|
title: "When not to use Blank Lines"
|
||||||
tags: ["AL","Readability"]
|
tags: ["AL","Readability"]
|
||||||
categories: ["Best Practice"]
|
categories: ["Best Practice"]
|
||||||
---
|
---
|
||||||
|
|
||||||
## Description
|
## Description
|
||||||
|
|
||||||
Avoid too many blank lines.
|
Do not use blank lines:
|
||||||
|
|
||||||
|
- at the beginning or end of any functions (after `begin` and before `end`)
|
||||||
|
- inside multiline expression
|
||||||
|
- after blank lines
|
||||||
|
|
||||||
## Example 1
|
## Example 1
|
||||||
|
|
||||||
### Bad code
|
### Bad code
|
||||||
|
|
||||||
```al
|
```al
|
||||||
var
|
procedure MATRIX_OnDrillDown(MATRIX_ColumnOrdinal: Integer);
|
||||||
UserSetup: Record "User Setup";
|
|
||||||
IsEditable: Boolean;
|
|
||||||
IsVisible: Boolean;
|
|
||||||
|
|
||||||
|
|
||||||
local procedure Initialize()
|
|
||||||
begin
|
begin
|
||||||
IsEditable := false;
|
|
||||||
IsVisible := false;
|
|
||||||
|
|
||||||
|
SetupDrillDownCol(MATRIX_ColumnOrdinal);
|
||||||
|
DrillDown(false, ValueType);
|
||||||
|
|
||||||
UserSetup.Get();
|
|
||||||
end;
|
end;
|
||||||
```
|
```
|
||||||
|
|
||||||
### Good code
|
### Good code
|
||||||
|
|
||||||
```al
|
```al
|
||||||
var
|
procedure MATRIX_OnDrillDown(MATRIX_ColumnOrdinal: Integer);
|
||||||
UserSetup: Record "User Setup";
|
|
||||||
IsEditable: Boolean;
|
|
||||||
IsVisible: Boolean;
|
|
||||||
|
|
||||||
local procedure Initialize()
|
|
||||||
begin
|
begin
|
||||||
IsEditable := false;
|
SetupDrillDownCol(MATRIX_ColumnOrdinal);
|
||||||
IsVisible := false;
|
DrillDown(false, ValueType);
|
||||||
|
|
||||||
UserSetup.Get();
|
|
||||||
end;
|
end;
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
@ -51,59 +41,18 @@ end;
|
||||||
### Bad code
|
### Bad code
|
||||||
|
|
||||||
```al
|
```al
|
||||||
page 50000 "Blank Lines"
|
if NameIsValid and
|
||||||
{
|
|
||||||
PageType = List;
|
|
||||||
ApplicationArea = All;
|
|
||||||
UsageCategory = Administration;
|
|
||||||
SourceTable = Customer;
|
|
||||||
|
|
||||||
|
Name2IsValid
|
||||||
layout
|
then
|
||||||
{
|
|
||||||
area(Content)
|
|
||||||
{
|
|
||||||
repeater(GroupName)
|
|
||||||
{
|
|
||||||
ShowCaption = false;
|
|
||||||
|
|
||||||
|
|
||||||
field(Name; Rec.Name)
|
|
||||||
{
|
|
||||||
ApplicationArea = All;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Good code
|
### Good code
|
||||||
|
|
||||||
```al
|
```al
|
||||||
page 50000 "Blank Lines"
|
if NameIsValid and
|
||||||
{
|
Name2IsValid
|
||||||
PageType = List;
|
then
|
||||||
ApplicationArea = All;
|
|
||||||
UsageCategory = Administration;
|
|
||||||
SourceTable = Customer;
|
|
||||||
|
|
||||||
layout
|
|
||||||
{
|
|
||||||
area(Content)
|
|
||||||
{
|
|
||||||
repeater(GroupName)
|
|
||||||
{
|
|
||||||
ShowCaption = false;
|
|
||||||
|
|
||||||
field(Name; Rec.Name)
|
|
||||||
{
|
|
||||||
ApplicationArea = All;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Example 3
|
## Example 3
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue