in reply to arrays: shifting in while loop
My understanding is that the while will execute so long as there are elements in @a...
ivanthemad: I expect you already understand the following point perfectly well, but I want to dispell my sneaking suspicion of a possible misapprehension on your part.
The while-loop in the example code will only begin execution (Update: of a loopthe loop body) if the array is non-empty. However, (Update: once begun) looploop body execution will continue regardless of the state of the array unless an explicit loop exit is made conditional upon array state, e.g., with a statement like last unless @a;.
Update: Clarified (hopefully) pertinence to loop body per repellent.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: arrays: shifting in while loop
by repellent (Priest) on Mar 07, 2012 at 05:01 UTC | |
by AnomalousMonk (Archbishop) on Mar 07, 2012 at 15:17 UTC | |
by repellent (Priest) on Mar 07, 2012 at 17:07 UTC |