-- Demonstrates attributes:
--     first, last
--     image, value
--     pos, val
with ada.text_io; use ada.text_io; 
with ada.integer_text_io; use ada.integer_text_io; 
-- with ada.text_io.Enumeration_io;
 
procedure attributes is
    i: Integer;
    n: Natural;
    p: Positive;
    b: Boolean;
    c: Character;

    package Boolean_io is new Enumeration_io(Boolean);
    use Boolean_io;
begin
    -- Type'first, Type'last
    put(Integer'first); new_line;
    put(Integer'last); new_line;
    put(Natural'first); new_line;
    put(Natural'last); new_line;

    put(Boolean'first); new_line;
    put(Boolean'last); new_line;

    -- 'image and 'value are inverses
    i := Integer'value("123");
    put(i); new_line;
    put_line(integer'image(integer'value("456")));
    -- put(("456")'val);
    --
    put(Boolean'val(0));         -- false
    put(Boolean'pos(true));      -- 0

    put(Character'val(65));      -- 'A'
    put(Character'pos('A'));     -- 65
    
end attributes;