diff --git a/content/BCBestPractices/Readability/begin-end/index.md b/content/BCBestPractices/Readability/begin-end/index.md index 52394bff..a2bcf372 100644 --- a/content/BCBestPractices/Readability/begin-end/index.md +++ b/content/BCBestPractices/Readability/begin-end/index.md @@ -20,7 +20,7 @@ end; ## Good code ```AL -IF FindSet() then +if FindSet() then repeat ... until next() = 0; @@ -29,24 +29,24 @@ IF FindSet() then ## Bad code ```AL -IF IsAssemblyOutputLine then begin - TestField("Order Line No.",0); +if IsAssemblyOutputLine then begin + TestField("Order Line No.", 0); end; ``` ## Good code ```AL -IF IsAssemblyOutputLine then - TestField("Order Line No.",0); +if IsAssemblyOutputLine then + TestField("Order Line No.", 0); ``` ## Exception ```AL // Except for this case -IF X then begin - IF Y then +if X then begin + if Y then //DO SOMETHING; end else (not X) diff --git a/content/BCBestPractices/Readability/end-else-pair/index.md b/content/BCBestPractices/Readability/end-else-pair/index.md index 88511484..c654ebf0 100644 --- a/content/BCBestPractices/Readability/end-else-pair/index.md +++ b/content/BCBestPractices/Readability/end-else-pair/index.md @@ -17,6 +17,7 @@ The `end else` pair should always appear on the same line. ... end else + begin ... end; ``` @@ -27,7 +28,7 @@ The `end else` pair should always appear on the same line. if OppEntry.Find('-') then if SalesCycleStage.Find('-') then begin ... - end else + end else begin ... end; ``` @@ -36,4 +37,4 @@ The `end else` pair should always appear on the same line. You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices). -If you don't find the discussion of this guideline, please feel fee to create a new one with the same title as this article. \ No newline at end of file +If you don't find the discussion of this guideline, please feel fee to create a new one with the same title as this article. diff --git a/content/BCBestPractices/Readability/named-invocations/index.md b/content/BCBestPractices/Readability/named-invocations/index.md index 285367cc..e6c2ae03 100644 --- a/content/BCBestPractices/Readability/named-invocations/index.md +++ b/content/BCBestPractices/Readability/named-invocations/index.md @@ -11,17 +11,17 @@ When calling an object statically use the Object Name, not the Object Id. ## Bad code ```al - Page.RunModal(525,SalesShptLine) + Page.RunModal(525, SalesShptLine); ``` ## Good code ```al - Page.RunModal(Page::"Posted Sales Shipment Lines",SalesShptLine) + Page.RunModal(Page::"Posted Sales Shipment Lines", SalesShptLine); ``` ## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=named+invocations+category%3A%22BC+Best+Practices%22) You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices). -If you don't find the discussion of this guideline, please feel fee to create a new one with the same title as this article. \ No newline at end of file +If you don't find the discussion of this guideline, please feel fee to create a new one with the same title as this article. diff --git a/content/BCBestPractices/Readability/one-statement-per-line/index.md b/content/BCBestPractices/Readability/one-statement-per-line/index.md index 6ac25caa..c5085b87 100644 --- a/content/BCBestPractices/Readability/one-statement-per-line/index.md +++ b/content/BCBestPractices/Readability/one-statement-per-line/index.md @@ -11,7 +11,7 @@ A line of code should not have more than one statement. ## Bad code ```al - if OppEntry.Find('-') then exit(); + if OppEntry.Find('-') then exit; ``` @@ -19,7 +19,7 @@ A line of code should not have more than one statement. ```al if OppEntry.Find('-') then - exit(); + exit; ``` ## Bad code @@ -40,4 +40,4 @@ A line of code should not have more than one statement. You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices). -If you don't find the discussion of this guideline, please feel fee to create a new one with the same title as this article. \ No newline at end of file +If you don't find the discussion of this guideline, please feel fee to create a new one with the same title as this article. diff --git a/content/BCBestPractices/Readability/separate-if-and-else/index.md b/content/BCBestPractices/Readability/separate-if-and-else/index.md index 77938943..b74acec1 100644 --- a/content/BCBestPractices/Readability/separate-if-and-else/index.md +++ b/content/BCBestPractices/Readability/separate-if-and-else/index.md @@ -11,7 +11,7 @@ weight = 1050 ## Bad code ```al - if Atom = '\>' then HasLogicalOperator := TRUE else begin + if Atom = '\>' then HasLogicalOperator := true else begin ... end; ``` @@ -31,4 +31,4 @@ weight = 1050 You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices). -If you don't find the discussion of this guideline, please feel fee to create a new one with the same title as this article. \ No newline at end of file +If you don't find the discussion of this guideline, please feel fee to create a new one with the same title as this article. diff --git a/content/BCBestPractices/Readability/unnecessary-else/index.md b/content/BCBestPractices/Readability/unnecessary-else/index.md index c3b0f301..ee900d0a 100644 --- a/content/BCBestPractices/Readability/unnecessary-else/index.md +++ b/content/BCBestPractices/Readability/unnecessary-else/index.md @@ -13,10 +13,10 @@ weight = 1270 ```al procedure SomeProcedure() begin - if IsAdjmtBinCodeChanged then - Error(AdjmtBinCodeChangeNotAllowedErr,...) + if IsAdjmtBinCodeChanged() then + Error(AdjmtBinCodeChangeNotAllowedErr, ...) else - Error(BinCodeChangeNotAllowedErr,...); + Error(BinCodeChangeNotAllowedErr, ...); end; ``` @@ -24,9 +24,9 @@ weight = 1270 ```al procedure SomeProcedure() begin - if IsAdjmtBinCodeChanged then - Error(AdjmtBinCodeChangeNotAllowedErr,...) - Error(BinCodeChangeNotAllowedErr,...); + if IsAdjmtBinCodeChanged() then + Error(AdjmtBinCodeChangeNotAllowedErr, ...) + Error(BinCodeChangeNotAllowedErr, ...); end; ``` @@ -35,4 +35,4 @@ weight = 1270 You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices). -If you don't find the discussion of this guideline, please feel fee to create a new one with the same title as this article. \ No newline at end of file +If you don't find the discussion of this guideline, please feel fee to create a new one with the same title as this article. diff --git a/content/BCBestPractices/Readability/variable-naming/index.md b/content/BCBestPractices/Readability/variable-naming/index.md index 858d973b..6ac4d757 100644 --- a/content/BCBestPractices/Readability/variable-naming/index.md +++ b/content/BCBestPractices/Readability/variable-naming/index.md @@ -17,19 +17,19 @@ If a variable is a compound of two or more words or abbreviations, each word or ## Bad code ```al - WIPBuffer : Record "Job WIP Buffer" + WIPBuffer: Record "Job WIP Buffer" ``` ## Good code ```al - JobWIPBuffer : Record "Job WIP Buffer" + JobWIPBuffer: Record "Job WIP Buffer" ``` ## Bad code ```al - Postline : Codeunit "Gen. Jnl.-Post Line"; + Postline: Codeunit "Gen. Jnl.-Post Line"; ``` ## Good code ```al - GenJnlPostLine : Codeunit "Gen. Jnl.-Post Line"; + GenJnlPostLine: Codeunit "Gen. Jnl.-Post Line"; ``` ## Bad code ```al @@ -44,4 +44,4 @@ If a variable is a compound of two or more words or abbreviations, each word or You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices). -If you don't find the discussion of this guideline, please feel fee to create a new one with the same title as this article. \ No newline at end of file +If you don't find the discussion of this guideline, please feel fee to create a new one with the same title as this article. diff --git a/content/BCBestPractices/Readability/variables-declarations-order/index.md b/content/BCBestPractices/Readability/variables-declarations-order/index.md index d5b47167..7ec97cc5 100644 --- a/content/BCBestPractices/Readability/variables-declarations-order/index.md +++ b/content/BCBestPractices/Readability/variables-declarations-order/index.md @@ -28,19 +28,19 @@ Variables declarations should be ordered by type. In general, object and complex ## Bad code ```al - StartingDateFilter : Text; - Vendor : Record Vendor; + StartingDateFilter: Text; + Vendor: Record Vendor; ``` ## Good code ```al - Vendor : Record Vendor; - StartingDateFilter : Text; + Vendor: Record Vendor; + StartingDateFilter: Text; ``` ## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=one+variables+declarations+order+category%3A%22BC+Best+Practices%22) You can find discussions on all "Best Practices" [here](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices). -If you don't find the discussion of this guideline, please feel fee to create a new one with the same title as this article. \ No newline at end of file +If you don't find the discussion of this guideline, please feel fee to create a new one with the same title as this article.