Page 1 of 1

$idx

Posted: Wed Jul 30, 2008 12:59 am
by 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.