file: job.t package: muf status: alpha
The foreach
construct is Muq MUF's tool for
conveniently iterating over all public keys (and optionally
values) on an object:
Stack: makeIndex --> o Stack: 101 --> o.a 102 --> o.b 103 --> o.c Stack: o foreach key val do{ [ "%s:%d\n" key val | ]print , } a:101 b:102 c:103 Stack:
The foreach
operator accepts one object argument, then
executes the given code clause once for each public key on the
object, setting the given key
local variable succesively
to each key.
If the optional val
local variable is also supplied,
it will be filled in with the corresponding value. If this
variable is not supplied, the values of the various keys are
not fetched, which may speed the loop somewhat.
The current implementation does not automatically store
changes to the val
variable back to the given object.
Matching constructs are available to loop over the other four areas of an object: foreachHidden, foreachSystem and foreachAdmins.
Go to the first, previous, next, last section, table of contents.