Algorithm Math Delphi

Title: How to sort an Array with the Shell Sort Algorithm
Procedure Sort_Shell(var a: array of Word);
var
bis, i, j, k: LongInt;
h: Word;
begin
bis := High(a);
k := bis shr 1;// div 2
while k 0 do
begin
for i := 0 to bis - k do
begin
j := i;
while (j = 0) and (a[j] a[j k]) do
begin
h := a[j];
a[j] := a[j k];
a[j k] := h;
if j k then
Dec(j, k)
else
j := 0;
end; // {end while]
end; // { end for}
k := k shr 1; // div 2
end; // {end while}
end;