separate (Inquiry_Operations)

--  Prompts the user for a Yes-No response, converting the
--            answer to type BOOLEAN

function Answer (Prompt : String) return Boolean is
    Length : Natural;      -- kludge for VMS erroneous treatment of
    Response : String (1 .. 3); -- GET on single CHARACTER
    --^^  RESPONSE: STRING(1..1); -- GET on single CHARACTER
begin
    Put (Standard_Output, Prompt);
    Put (Standard_Output, " [y|n]: ");
    Get_Line (Response, Length); -- VMS kludge
    loop
        -- until RESPONSE = valid Y/N input
        case Response (1) is
            when 'Y' | 'y' =>
                return True;
            when 'N' | 'n' =>
                return False;
            when others =>
                Put_Line (Standard_Output, "... please try again.");
                Get_Line (Response, Length);  -- VMS kludge
        end case;
    end loop;
exception
    when Data_Error =>
        Put_Line (Standard_Output, "... please try again.");
        return Answer (Prompt);
    when End_Error =>
        return False;
    when others =>
        Put_Line (Standard_Output, "*** exception caught in ANSWER");
        return False;
end Answer;
--****************************************************************************