added some blank lines examples
This commit is contained in:
parent
7cf65b3d3b
commit
16aaca3614
1 changed files with 119 additions and 9 deletions
|
|
@ -1,6 +1,6 @@
|
|||
---
|
||||
title: "Avoid too many blank lines"
|
||||
tags: ["AL"]
|
||||
tags: ["AL","Readability"]
|
||||
categories: ["Best Practice"]
|
||||
---
|
||||
|
||||
|
|
@ -12,17 +12,18 @@ Avoid too many blank lines.
|
|||
|
||||
```al
|
||||
var
|
||||
IsVisible: Boolean;
|
||||
UserSetup: Record "User Setup";
|
||||
IsEditable: Boolean;
|
||||
IsVisible: Boolean;
|
||||
|
||||
|
||||
local procedure Init()
|
||||
local procedure Initialize()
|
||||
begin
|
||||
IsVisible := false;
|
||||
IsEditable := false;
|
||||
IsVisible := false;
|
||||
|
||||
|
||||
exit(true);
|
||||
UserSetup.Get();
|
||||
end;
|
||||
```
|
||||
|
||||
|
|
@ -30,14 +31,123 @@ end;
|
|||
|
||||
```al
|
||||
var
|
||||
IsVisible: Boolean;
|
||||
UserSetup: Record "User Setup";
|
||||
IsEditable: Boolean;
|
||||
IsVisible: Boolean;
|
||||
|
||||
local procedure Init()
|
||||
local procedure Initialize()
|
||||
begin
|
||||
IsVisible := false;
|
||||
IsEditable := false;
|
||||
IsVisible := false;
|
||||
|
||||
exit(true);
|
||||
UserSetup.Get();
|
||||
end;
|
||||
```
|
||||
|
||||
## Bad code
|
||||
|
||||
```al
|
||||
page 50000 "Blank Lines"
|
||||
{
|
||||
PageType = List;
|
||||
ApplicationArea = All;
|
||||
UsageCategory = Administration;
|
||||
SourceTable = Customer;
|
||||
|
||||
|
||||
layout
|
||||
{
|
||||
area(Content)
|
||||
{
|
||||
repeater(GroupName)
|
||||
{
|
||||
ShowCaption = false;
|
||||
|
||||
|
||||
field(Name; Rec.Name)
|
||||
{
|
||||
ApplicationArea = All;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Good code
|
||||
|
||||
```al
|
||||
page 50000 "Blank Lines"
|
||||
{
|
||||
PageType = List;
|
||||
ApplicationArea = All;
|
||||
UsageCategory = Administration;
|
||||
SourceTable = Customer;
|
||||
|
||||
layout
|
||||
{
|
||||
area(Content)
|
||||
{
|
||||
repeater(GroupName)
|
||||
{
|
||||
ShowCaption = false;
|
||||
|
||||
field(Name; Rec.Name)
|
||||
{
|
||||
ApplicationArea = All;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
## Bad code
|
||||
|
||||
```al
|
||||
var
|
||||
GLSetup: Record "General Ledger Setup";
|
||||
GLSetupRead: Boolean;
|
||||
|
||||
|
||||
local procedure GetGLSetup()
|
||||
begin
|
||||
if not GLSetupRead then
|
||||
GLSetup.Get();
|
||||
|
||||
|
||||
GLSetupRead := true;
|
||||
|
||||
|
||||
OnAfterGetGLSetup(GLSetup);
|
||||
end;
|
||||
|
||||
|
||||
[IntegrationEvent(false, false)]
|
||||
local procedure OnAfterGetGLSetup(var GLSetup: Record "General Ledger Setup")
|
||||
begin
|
||||
end;
|
||||
```
|
||||
|
||||
## Good code
|
||||
|
||||
```al
|
||||
var
|
||||
GLSetup: Record "General Ledger Setup";
|
||||
GLSetupRead: Boolean;
|
||||
|
||||
local procedure GetGLSetup()
|
||||
begin
|
||||
if not GLSetupRead then
|
||||
GLSetup.Get();
|
||||
|
||||
GLSetupRead := true;
|
||||
|
||||
OnAfterGetGLSetup(GLSetup);
|
||||
end;
|
||||
|
||||
[IntegrationEvent(false, false)]
|
||||
local procedure OnAfterGetGLSetup(var GLSetup: Record "General Ledger Setup")
|
||||
begin
|
||||
end;
|
||||
```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue