In Ada 95, is there a graceful way to get around EXIT WHEN [Boolean] in a LOOP?

In this code fragment embedded within a FOR-LOOP

          IF NOT( pos_dup_chr_int = 0) THEN
             -- some repeat string assignment here
             exit_when_true_int := 1 ;
             EXIT WHEN exit_when_true_int := 1 ;
          END IF ;

is there a way to get around the obtuse true flag to exit the loop gracefully?

exit;

Or did you mean something else?

EXIT alone means something else to me as I understand Ada 95 as a beginner, namely to EXIT the component which is a PROCEDURE rather than to fall through to the next code block within the PROCEDURE.

Is exit_when_true_int used outside of the loop? When true, you can simplify removing the condition, as it is inside the if:

         IF NOT( pos_dup_chr_int = 0) THEN
             -- some repeat string assignment here
             exit_when_true_int := 1 ;
             EXIT ;
         END IF ;

When the variable is not used outside the loop, just do this:

         EXIT WHEN pos_dup_chr_int /= 0 ;

By the way, exit exits a loop, and for procedures, you have to use return. You should review that part of your reference tutorial.

You’re thinking of return

But you are wrong.

A95RM 5.7(1): “An exit_statement is used to complete the execution of an enclosing loop_statement; the completion is conditional if the exit_statement includes a condition.”

Thanks for reply.

exit_when_true_int is not used outside the loop.
When exit_when_true_int is used inside the loop as given, I figured out it is not needed because the graceful way to get around EXIT WHEN [some Boolean] is simply EXIT which always refers only to the short circuit of loops.

RETURN short circuits PROCEDURES, as Simon writes citing ARM95 which is not a tutorial or programmer’s manual, but a requirements document intended for compiler vendors.

In regard to review that part of of my reference tutorial, yes of course. And it’s a good idea to read Cohen 1986 more closely, and for me to abandon Lovelace with all its source code not in a professional fixed width font, among other warts.