Main Menu

$idx

Started by Jeremy Dunn, July 29, 2008, 05:59:26 PM

Previous topic - Next topic

Jeremy Dunn

Now that $idx has been added to all looping structures could it be useful to also have two more? I wanted to suggest having two more locals named $prev and $next that would be defined as



$prev = $idx - 1

$next = $idx + 1



Often in loops it is the previous or next element that I am interested in also, this would provide a convenient way to get to them rather incrementing or decrementing explicitly.