From 1640719b7a7328ca251f5c68eeb51ea11095312d Mon Sep 17 00:00:00 2001 From: waldo1001 Date: Sat, 11 Dec 2021 13:09:18 +0100 Subject: [PATCH 1/4] Line Start Keywords --- .../line-start-keywords/index.md | 36 +++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 content/BCBestPractices/line-start-keywords/index.md diff --git a/content/BCBestPractices/line-start-keywords/index.md b/content/BCBestPractices/line-start-keywords/index.md new file mode 100644 index 00000000..7f537b00 --- /dev/null +++ b/content/BCBestPractices/line-start-keywords/index.md @@ -0,0 +1,36 @@ ++++ +title = "Line Start Keywords" +weight = 740 ++++ + +<_Created by Microsoft, Described by waldo_\> + +## Description +The `end`, `if`, `repeat`, `for`, `while`, `else` and `case` statement should always start a line. + +## Bad code + +```al + if IsContactName then ValidateContactName + else if IsSalespersonCode then ValidateSalespersonCode + else if IsSalesCycleCode then ValidatSalesCycleCode; +``` + +## Good code + +```al + if IsContactName then + ValidateContactName + else + if IsSalespersonCode then + ValidateSalespersonCode + else + if IsSalesCycleCode then ValidatSalesCycleCode; +``` + + +## [Discussions](https://github.com/microsoft/alguidelines/discussions/categories/bc-best-practices?discussions_q=line+start+keyword+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 From 0165f89090a7f2546c06a5d601fd0894d3e83db6 Mon Sep 17 00:00:00 2001 From: waldo1001 Date: Sat, 11 Dec 2021 13:28:27 +0100 Subject: [PATCH 2/4] Move --- .../{ => Readability}/line-start-keywords/index.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename content/BCBestPractices/{ => Readability}/line-start-keywords/index.md (100%) diff --git a/content/BCBestPractices/line-start-keywords/index.md b/content/BCBestPractices/Readability/line-start-keywords/index.md similarity index 100% rename from content/BCBestPractices/line-start-keywords/index.md rename to content/BCBestPractices/Readability/line-start-keywords/index.md From 6877f439e9025f0d0495d266dcd06ed8379c8eec Mon Sep 17 00:00:00 2001 From: waldo1001 Date: Mon, 13 Dec 2021 17:12:15 +0100 Subject: [PATCH 3/4] requested change --- .../BCBestPractices/Readability/line-start-keywords/index.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/content/BCBestPractices/Readability/line-start-keywords/index.md b/content/BCBestPractices/Readability/line-start-keywords/index.md index 7f537b00..503768e7 100644 --- a/content/BCBestPractices/Readability/line-start-keywords/index.md +++ b/content/BCBestPractices/Readability/line-start-keywords/index.md @@ -25,7 +25,8 @@ The `end`, `if`, `repeat`, `for`, `while`, `else` and `case` statement should al if IsSalespersonCode then ValidateSalespersonCode else - if IsSalesCycleCode then ValidatSalesCycleCode; + if IsSalesCycleCode then + ValidatSalesCycleCode; ``` From 21bb12f665b42d82214c4fe90c4b3c82acf31720 Mon Sep 17 00:00:00 2001 From: waldo Date: Tue, 14 Dec 2021 22:30:32 +0100 Subject: [PATCH 4/4] added "()" --- .../Readability/line-start-keywords/index.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/content/BCBestPractices/Readability/line-start-keywords/index.md b/content/BCBestPractices/Readability/line-start-keywords/index.md index 503768e7..dc758f29 100644 --- a/content/BCBestPractices/Readability/line-start-keywords/index.md +++ b/content/BCBestPractices/Readability/line-start-keywords/index.md @@ -11,22 +11,22 @@ The `end`, `if`, `repeat`, `for`, `while`, `else` and `case` statement should al ## Bad code ```al - if IsContactName then ValidateContactName - else if IsSalespersonCode then ValidateSalespersonCode - else if IsSalesCycleCode then ValidatSalesCycleCode; + if IsContactName then ValidateContactName() + else if IsSalespersonCode then ValidateSalespersonCode() + else if IsSalesCycleCode then ValidatSalesCycleCode(); ``` ## Good code ```al if IsContactName then - ValidateContactName + ValidateContactName() else if IsSalespersonCode then - ValidateSalespersonCode + ValidateSalespersonCode() else if IsSalesCycleCode then - ValidatSalesCycleCode; + ValidatSalesCycleCode(); ```