-- Chapter 9 - Programming exercise 1 with Text_IO; use Text_IO; procedure CH09_1 is package Int_IO is new Text_IO.Integer_IO(INTEGER); use Int_IO; Index, Count : INTEGER; begin Index := 27; Count := 33; Put("In the main block - values are"); Put(Index); -- CH09_1.Index Put(Count); -- CH09_1.Count New_Line; declare Index, Stuff : INTEGER := -345; procedure Output_A_Line is begin Put_Line("This is in the new block procedure"); end Output_A_Line; begin Index := 157; Put("In the embedded block - values are"); Put(CH09_1.Index); -- CH09_1.Index Put(Index); -- local Index Put(Stuff); -- local Stuff Put(Count); -- CH09_1.Count New_Line; Output_A_Line; end; Put("Back to the main block - values are"); Put(Index); -- CH09_1.Index Put(Count); -- CH09_1.Count New_Line; Who: -- Block name declare Index, Stuff : INTEGER := -345; begin Index := 157; Put("In the block named Who - values are"); Put(CH09_1.Index); -- CH09_1.Index Put(Index); -- Who.Index Put(Who.Index); -- Who.Index Put(Stuff); -- Who.Stuff Put(Who.Stuff); -- Who.Stuff Put(Count); -- CH09_1.Count New_Line; end Who; Put("Back to the main block - values are"); Put(Index); -- CH09_1.Index Put(Count); -- CH09_1.Count New_Line; end CH09_1; -- Result of execution -- In the main block - values are 27 33 -- In the embedded block - values are 27 157 -345 33 -- This is in the new block procedure -- Back to the main block - values are 27 33 -- In the block named Who - values are 27 157 157 -345 -345 33 -- Back to the main block - values are 27 33 -- Note; some blanks were removed to fit the data in 70 columns.