PROC prompt_for_answer (
  prompt, p: string = $required
  answer, a: VAR of boolean = $required)

" This procedure is similar to code in deck : RAF$PROMPT_FOR_ANSWER

  create_variable choice k=string

  display_value ('  ', $value(prompt))

answer_loop: ..
  LOOP
    accept_line choice input prompt='Enter yes or no: '
    choice = $translate(lower_to_upper, choice)
    IF (choice = 'Y' OR choice = 'YES') THEN
      $value(answer) = true
      EXIT answer_loop
    ELSEIF (choice = 'N' OR choice = 'NO') THEN
      $value(answer) = false
      EXIT answer_loop
    ELSE
      display_value '--ERROR--  You must enter yes or no.  Please try again.'
    IFEND
  LOOPEND answer_loop

PROCEND prompt_for_answer
