-- Chapter 26 - Programming exercise 2 with Ada.Text_IO; use Ada.Text_IO; with Ada.Integer_Text_IO; use Ada.Integer_Text_IO; procedure CH26_2 is begin for Index in 1..4 loop delay 0.5; Put_Line("This is in the main program."); end loop; declare task First_Task; task Second_Task; task Third_Task; task body First_Task is begin for Index in 1..4 loop delay 0.0; Put_Line("This is in First_Task."); end loop; end First_Task; task body Second_Task is begin for Index in 1..4 loop delay 0.0; Put_Line("This is in Second_Task."); end loop; end Second_Task; task body Third_Task is begin for Index in 1..8 loop delay 0.0; Put_Line("This is in Third_Task."); end loop; end Third_Task; begin delay 0.0; Put_Line("This is in the block body."); delay 0.0; Put_Line("This is also in the block body."); end; -- of declare for Index in 1..4 loop delay 0.5; Put_Line("This is at the end of the main program."); end loop; end CH26_2; -- Result of Execution -- This is in the main program. -- This is in the main program. -- This is in the main program. -- This is in the main program. -- This is in First_Task. -- This is in Second_Task. -- THis is in the block body. -- This is in Third_Task. -- This is in First_Task. -- This is in Second_Task. -- This is also in the block body. -- This is in Third_Task. -- This is in First_Task. -- This is in Second_Task. -- This is in Third_Task. -- This is in First_Task. -- This is in Second_Task. -- This is in Third_Task. -- This is in Third_Task. -- This is in Third_Task. -- This is in Third_Task. -- This is in Third_Task. -- This is at the end of the main program. -- This is at the end of the main program. -- This is at the end of the main program. -- This is at the end of the main program.