StructEach()
call the given UDF/Closure with every entry (key/value) in the struct.
StructEach( struct=struct, closure=function, parallel=boolean, maxThreads=number );
Returns: void
Examples
Non-Member Function
animals = {
cow: "moo",
pig: "oink",
cat: "meow"
};
StructEach(animals, function(key) {
// Show key 'arguments.key'
Dump(
label: "Key",
var: arguments.key
);
<span class="c">// Show key's value 'animals[arguments.key]'</span>
<span class="nf">Dump</span><span class="p">(</span>
<span class="nv">label</span><span class="p">:</span> <span class="nv">arguments.key</span> <span class="o">&</span> <span class="s2">"'s value"</span><span class="p">,</span>
<span class="k">var</span><span class="p">:</span> <span class="nv">animals</span><span class="p">[</span><span class="nv">arguments.key</span><span class="p">]</span>
<span class="p">);</span>
});
See also
- Collections
- Structures
- Threads
- struct.each()
- Search Issue Tracker
- Search Lucee Test Cases (good for further, detailed examples)