How do I list the number of elements in a vector, i.e test : array[1..10] of string; ?

I think it's something like this

program ??;

var test : array[0..4] of String;
      l : Integer;


begin

a[0] := '1';
a[1] := '2';
a[2] := '3';
a[3] := '4';
a[4] := '5';  
   
 
writeLn('There are ',length(a),' elements in the array');

end.

length() returns the number of elements in an array.
low() returns the index of the first element.
high() returns the index of the last element.
setLength() changes the size of a dynamic array.

var
  xs: array of integer;
  cntr: integer;
begin
  setLength( xs, 5 );
  writeln( 'Please enter ', length( xs ), ' integers: ' );
  for cntr := low( xs ) to high( xs ) do read( xs[ cntr ] );
end.
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.