Manual:DIL Manual/continue
Jump to navigation
Jump to search
Contents
continue
Instruction. Skips the rest of the loop's statement and starts its next round.
continue;
In a while it goes back to the loop's test; in a foreach it goes on with the next unit. It acts on the innermost loop around it.
Notes
- Outside a loop vmc stops with "Using continue outside loop".
- In a
while, take the step before thecontinue. Acontinuethat skipsu := u.next;runs the same round again and again, until the server stops the program for an endless loop.
Example
dilbegin carried_weight();
var
u : unitptr;
w : unitptr;
n : integer;
code
{
u := self.inside;
while (u != null)
{
w := u;
u := u.next;
if (w.equip != 0)
continue;
n := n + w.weight;
}
exec("say What I carry weighs " + itoa(n) + ", not counting what I wear.", self);
quit;
}
dilend
Adds up the weight of what an NPC carries but doesn't wear. The step to the next unit comes before the continue.