in reply to at continue, last

I suppose there is more then one (disguised) goto otherwise nesting two if should do and is easily understood.

But no matter how many exit-points you have, the entry-point is always the same. So why don't you decrement there after the first if ?

Cheers Rolf

(addicted to the Perl Programming Language)

Replies are listed 'Best First'.
Re^2: at continue, last
by Anonymous Monk on Jun 06, 2014 at 17:41 UTC
    $loop is used in the conditional, so if I decremented it first, I'd have to add one to it everywhere it is being used.
      > $loop is used in the conditional, so if I decremented it first,...

      Unclear.

      None of your examples have $loop in the conditional and I suggested decrementing it after not before !

      Please explain what's different here

      if ( $condition1 ) { ... unless( $condition2 ) { ... } --$loop; # common exit point }

      Cheers Rolf

      (addicted to the Perl Programming Language)

        Sorry, my reply was clearer in my head then in my written words

        I meant to write that if I decremented it as the first statement in the if clause, I'd have to increment later on.

        The point of the examples wasn't the decrement, but to examine the ways of finding a single path to cleanup code from a conditional. In particular, I'm trying to avoid the nested if/else/unless clauses.

      Whoops. Forgot to log in. The above comment is mine.