in reply to Re: Easiest way to do something only on first iteration of loop
in thread Easiest way to do something only on first iteration of loop

I only realized now that all of the above solutions have the condition backward: the first time through the loop I don't want to print an indentation. An outer routine has already typed a "header", like a number or a bullet, to the left and the print-head is now positioned at the indentation column at the time the subroutine is called. The first line must be printed without further indentation, but any subsequent lines will need indentation.

Interestingly, it was only when reading the Perl 6 syntax that this leaped out at me. For my purpose I'd need the NEXT phaser rather than the FIRST phaser. Thanks for the tip.

  • Comment on Re^2: Easiest way to do something only on first iteration of loop

Replies are listed 'Best First'.
Re^3: Easiest way to do something only on first iteration of loop
by Anonymous Monk on May 09, 2016 at 17:41 UTC