From 2a1d252e4a77006205ddda96ca280ae9014f91b7 Mon Sep 17 00:00:00 2001 From: waldo1001 Date: Sat, 11 Dec 2021 13:51:25 +0100 Subject: [PATCH 1/2] Spacing Binary Operators --- .../spacing-binary-operators/index.md | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 content/BCBestPractices/Readability/spacing-binary-operators/index.md diff --git a/content/BCBestPractices/Readability/spacing-binary-operators/index.md b/content/BCBestPractices/Readability/spacing-binary-operators/index.md new file mode 100644 index 00000000..6275621a --- /dev/null +++ b/content/BCBestPractices/Readability/spacing-binary-operators/index.md @@ -0,0 +1,45 @@ ++++ +title = "Spacing Binary Operators" +weight = 1120 ++++ + +<_Created by Microsoft, Described by waldo_\> + +## Description +There must be exactly one space character on each side of a binary operator such as = + - AND OR =. The parameter comma operator however, should have no spaces. + +## Bad code + +```al + "Line Discount %" := "Line Discount Amount"/"Line Value"\*100; +``` + +## Good code + +```al + "Line Discount %" := "Line Discount Amount" / "Line Value" \* 100; +``` + +## Bad code + +```al + StartDate := CalcDate('<+'+Format(Days+i)+'D\>', StartDate); +``` + +## Good code + +```al + StartDate := CalcDate('<+' + Format(Days + i) + 'D\>',StartDate); +``` + +## Bad code + +```al + StartDate:=0D; // Initialize +``` + +## Good code + +```al + StartDate := 0D; // Initialize +``` \ No newline at end of file From 4eb73cb8d30d8510bedd33b34ecdf93d03432fe3 Mon Sep 17 00:00:00 2001 From: waldo Date: Tue, 14 Dec 2021 11:50:50 +0100 Subject: [PATCH 2/2] corrected the code --- .../Readability/spacing-binary-operators/index.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/content/BCBestPractices/Readability/spacing-binary-operators/index.md b/content/BCBestPractices/Readability/spacing-binary-operators/index.md index 6275621a..46e63427 100644 --- a/content/BCBestPractices/Readability/spacing-binary-operators/index.md +++ b/content/BCBestPractices/Readability/spacing-binary-operators/index.md @@ -6,30 +6,30 @@ weight = 1120 <_Created by Microsoft, Described by waldo_\> ## Description -There must be exactly one space character on each side of a binary operator such as = + - AND OR =. The parameter comma operator however, should have no spaces. +There must be exactly one space character on each side of a binary operator such as = + - AND OR =. The parameter comma operator however, should have a space after the comma. ## Bad code ```al - "Line Discount %" := "Line Discount Amount"/"Line Value"\*100; + "Line Discount %" := "Line Discount Amount"/"Line Value"*100; ``` ## Good code ```al - "Line Discount %" := "Line Discount Amount" / "Line Value" \* 100; + "Line Discount %" := "Line Discount Amount" / "Line Value" * 100; ``` ## Bad code ```al - StartDate := CalcDate('<+'+Format(Days+i)+'D\>', StartDate); + StartDate := CalcDate('<+'+Format(Days+i)+'D\>',StartDate); ``` ## Good code ```al - StartDate := CalcDate('<+' + Format(Days + i) + 'D\>',StartDate); + StartDate := CalcDate('<+' + Format(Days + i) + 'D\>', StartDate); ``` ## Bad code