List objects are one-based (PC0004)

List and Dictionary collections in AL use one-based indexing, not zero-based. Attempting to access index 0 will result in a runtime error.

Example

The following code incorrectly uses zero-based indexing:

codeunit 50100 MyCodeunit
{
    procedure ProcessList()
    var
        MyList: List of [Text];
        Value: Text;
    begin
        MyList.Add('First');
        Value := MyList.Get(0); // List objects are one-based [PC0004]
    end;
}

To fix this, use one-based indexing:

codeunit 50100 MyCodeunit
{
    procedure ProcessList()
    var
        MyList: List of [Text];
        Value: Text;
    begin
        MyList.Add('First');
        Value := MyList.Get(1);
    end;
}