Skip to content
Lists & Helpers arrayMap

$arrayMap — Builds an array from the result of code run on each item.

Builds an array from the result of code run on each item.

Syntax

$arrayMap[array;variable;code;(other)]

Parameters

  • array (text, required) — Name of the array.
  • variable (text, required) — Local variable that holds the item.
  • code (code, required) — Code whose result replaces the item.
  • other (text, optional) — Array that receives the result.

Return Value

  • string.

Usage

$arrayMap[a;x;$sum[$env[x];1]]

Example

$sendMessage[$arrayMap[a;x;$sum[$env[x];1]]]

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.