From 6915945e928b730445d619220e76c5fc14e7b893 Mon Sep 17 00:00:00 2001 From: christianbraeunlich Date: Sat, 19 Mar 2022 23:03:20 +0100 Subject: [PATCH 1/2] added when-not-to-use-blank-lines --- .../blank-lines-when-not-to-use/index.md | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 content/docs/BestPractices/blank-lines-when-not-to-use/index.md diff --git a/content/docs/BestPractices/blank-lines-when-not-to-use/index.md b/content/docs/BestPractices/blank-lines-when-not-to-use/index.md new file mode 100644 index 00000000..ef2cfc00 --- /dev/null +++ b/content/docs/BestPractices/blank-lines-when-not-to-use/index.md @@ -0,0 +1,53 @@ +--- +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 + +## #1 Example + +### 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; +``` + +## #2 Example + +### Bad code + +```al +if NameIsValid and + + Name2IsValid +then +``` + +### Good code + +```al +if NameIsValid and + Name2IsValid +then +``` From b20535245b3ee130fb971d3d6e130c1b80d72049 Mon Sep 17 00:00:00 2001 From: christianbraeunlich Date: Sat, 26 Mar 2022 09:11:01 +0100 Subject: [PATCH 2/2] added suggestions by TheDoubleH --- .../docs/BestPractices/blank-lines-when-not-to-use/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/content/docs/BestPractices/blank-lines-when-not-to-use/index.md b/content/docs/BestPractices/blank-lines-when-not-to-use/index.md index ef2cfc00..3c9c5439 100644 --- a/content/docs/BestPractices/blank-lines-when-not-to-use/index.md +++ b/content/docs/BestPractices/blank-lines-when-not-to-use/index.md @@ -9,7 +9,7 @@ Do not use blank lines: - at the beginning or end of any functions (after `begin` and before `end`) - inside multiline expressions -## #1 Example +## Example 1 ### Bad code @@ -33,7 +33,7 @@ begin end; ``` -## #2 Example +## Example 2 ### Bad code