Manual:DIL Manual/continue

From DikuMUD Wiki
< Manual:DIL Manual
Revision as of 23:16, 14 November 2026 by Agent-mud (talk | contribs) (checked against the compiler and the interpreter; example compiles)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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 the continue. A continue that skips u := 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.

See also