-- Chapter 29 - Program 2
with Ada.Text_IO;
use Ada.Text_IO;
procedure TaskArry is
task type SHORT_LINE is
end SHORT_LINE;
task type LONG_LINE is
end LONG_LINE;
Cow : array (1..4) of SHORT_LINE;
Elephant, Hippopotamus : LONG_LINE;
task body SHORT_LINE is
begin
for Index in 1..4 loop
delay 0.0;
Put_Line("This is a short line");
end loop;
end SHORT_LINE;
task body LONG_LINE is
begin
for Index in 1..3 loop
delay 0.0;
Put_Line("This is a much longer line to be displayed");
end loop;
end LONG_LINE;
begin
Put_Line("This is an example of use of a task type array");
end TaskArry;
-- Result of execution
-- This is an example of use of a task type
-- This is a much longer line to be displayed
-- This is a much longer line to be displayed
-- This is a short line
-- This is a short line
-- This is a short line
-- This is a short line
-- This is a much longer line to be displayed
-- This is a much longer line to be displayed
-- This is a short line
-- This is a short line
-- This is a short line
-- This is a short line
-- This is a much longer line to be displayed
-- This is a much longer line to be displayed
-- This is a short line
-- This is a short line
-- This is a short line
-- This is a short line
-- This is a short line
-- This is a short line
-- This is a short line
-- This is a short line