Lists & Helpers
arrayForEach
$arrayForEach — Runs code once per item; $env[variable] holds the current item.
Runs code once per item; `$env[variable]` holds the current item.
Syntax
$arrayForEach[array;variable;code]
Parameters
- array (text, required) — Name of the array.
- variable (text, required) — Local variable that holds the item.
- code (code, required) — Code run for each item.
Return Value
- string.
Usage
$arrayForEach[a;x;$letSum[t;$env[x]]]
Example
$arrayLoad[a;,;3,1,2]
$arrayForEach[a;x;$letSum[total;$env[x]]]
$sendMessage[$get[total]]
Try it
Paste an example into the playground to preview its message (functions that act on Discord are not run), or build the same thing with blocks.