alguidelines/content/BCBestPractices/Readability/variables-declarations-order/index.md
2021-12-12 00:22:08 +01:00

1.1 KiB

+++ title = "Variables Declarations Order" weight = 1430 +++

<Created by Microsoft, Described by waldo>

Description

Variables declarations should be ordered by type. In general, object and complex variable types are listed first followed by simple variables. The order should be the same as the object list in the object designer for AL objects. Afterwards come the complex variables like RecordRef, .NET, FieldRef etc. At the end come all the simple data types in no particular order.

Bad code

    StartingDateFilter : Text;
    Vendor : Record Vendor;

Good code

    Vendor : Record Vendor;
    StartingDateFilter : Text;

Discussions

You can find discussions on all "Best Practices" here.

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.