-- Demonstrates declaring a variable in a declaration block.

with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_IO; use Ada.Integer_Text_IO;


procedure declareblk1  is 
    i: integer := 1;
begin
    i := 2 * i;

    -- Declaration blocks can be anywhere in a body
    declare
        j: Integer := i;
    begin
        j := 3 * j + i;
        put(j);
    end;

    put(i);

    -- put(j); -- Compile error.  Scope of j is the declare block
end declareblk1;

-- Output: 8          2