procedure tester is
LL : sorted_list.List;
begin
sorted_list.Insert(LL, 5);
declare
larray : sorted_list.ListArray(1..sorted_list.length(LL));
begin
larray := sorted_list.toArray(LL);
-- code that uses larray must be in this block
end;
end;
or
procedure tester is
LL : sorted_list.List;
begin
sorted_list.Insert(LL, 5);
declare
larray : sorted_list.ListArray := sorted_list.toArray(LL);
-- no need to specify the bounds, it will take them from the bounds
-- of the result returned by toArray
begin
-- code that uses larray must be in this block
end;
end;
A couple things to note: (1) The declarations in the block (beginning with declare
) are evaluated at the point where a statement would be executed (in fact, a block is one kind of statement), so it will use the LL
that has been set up at that point. (2) The variable larray
is visible only inside the block where you declared it.