Skip to main content

Variables

Variables store values that can be read and updated across block stacks and scripts.

Variable command blocks​

Set variable to (Beginner)​

block_variables_set_to.svg

Sets selected variable to the specified value.

  • Type: command block
  • Typical use: initialize state, overwrite previous value

Change variable by (Advanced)​

block_variables_change_by.svg

Adds the specified amount to selected variable.

  • Type: command block
  • Typical use: counters, score, accumulated distance/time

Variable value reporter​

Variable value (Beginner)​

variable.svg

Returns the current value of the selected variable.

  • Type: reporter block
  • Typical use: use variable value inside operators, conditions, and command inputs