Skip to content
Lists & Helpers default

$default — Gives the value, or the fallback when the value is empty

Gives the value, or the fallback when the value is empty. Also available as `$ifEmpty`.

Syntax

$default[value;fallback]

Parameters

  • value (text, required) — The value to check. Spaces only count as empty.
  • fallback (text, required) — Used only when the value is empty (it is not evaluated otherwise).

Return Value

  • string.

Usage

$default[$getGuildVar[welcome];Welcome!] → "Welcome!" while the variable is empty

Important Notes

  • Replaces the $if[$x==]…$else…$endif pattern.

Example

$sendMessage[$default[$getGuildVar[welcome];Welcome!]]

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.