Get Started
General

General

Block coding can be used in every value input in logic. Clicking the button on the right side of a value input offers four input methods.

  • Direct entry: Enter the value as-is.
  • Variable value: Use another variable's current value.
  • Block editor: Use the result calculated by assembled blocks.
  • Lua script: Write Lua code and use its return value.

All four methods must return a value matching the input's type; a mismatched type causes an error at execution time.

Block Editor

Select Block Editor and click Edit Block to open the editor. The editor consists of a toolbox, where blocks are organized by category, and a workspace, where blocks are connected together.

The Edit Block dialog with the toolbox, workspace, and return block
The Edit Block dialog. The toolbox is on the left, the workspace on the right, and the result connects to the return block.

Working with Blocks

  • The return block is already placed in the workspace and is the only path for sending a result out of the block editor. The type of the value connected to it must match the type of the value input.
  • Most blocks have inputs or outputs (some have neither). Blocks with outputs are dragged and connected to other blocks' inputs.
  • Inputs and outputs have data types, and only matching types can be connected. The data types are the same as variable types.
  • Hovering over a block shows its description as a tooltip; right-clicking shows the available commands.
  • Blocks with a variable number of inputs (if, text join, list creation, local function parameters, and so on) use the block's gear button to add, remove, or reorder entries.
  • Connecting a new block to an input that already holds one pushes the existing block out.
  • Shadow blocks are pre-filled for convenience and are deleted automatically when replaced by another block.
  • A finished assembly must be fully connected; empty inputs or outputs cause errors at execution time.
  • Blocks stacked vertically execute in order from top to bottom, and conditional statements and loops enable more complex calculations.
  • The break/continue block can only be used inside a loop block, and a local function's return if block only inside a local function.
Animation of dragging a block with an output and connecting it to another block's input
Drag a block that has an output and connect it to another block's input.
Animation showing that a block connects only to an input of the same data type
An input and an output connect only when their data types match.
A tooltip describing the round block and its input and output types, shown while hovering over the block
Hovering over a block shows its description and input and output formats as a tooltip.
The right-click menu of a block with Copy, Duplicate, Add Comment, External Inputs, Collapse Block, Disable Block, and Delete
Right-clicking a block shows the available commands.
Animation of a new block connected to an occupied input, pushing the existing block out
Connecting a new block to an input that already holds one pushes the existing block out.
Animation of a block connected in place of a shadow block, which then disappears
When another block is connected in place of a shadow block, the shadow block is deleted automatically.
An and block whose unconnected output and empty input are circled in red
A block with an empty input or an unconnected output causes an error at execution time. The red circles mark them.
Two stacked blocks: set var1 to the remainder of 64 divided by 10 plus 1, then set Number1 to var1
Stacked blocks run from top to bottom. The result is stored in a local variable and then written to a project variable.
An if block that, when Digital1 is true, computes var1 and writes it to Number1, then repeats 10 times adding 1 to Number1
Combining a conditional and a loop: when Digital1 is true, the result is written to Number1, which is then increased by 1 ten times.
Note Positions and indexes do not start at the same number in every category. Text and lists count from 1 and return 0 when nothing is found, while byte arrays, bits/bytes, JSON, and XML count from 0 (JSON returns -1 when nothing is found).
Note For angles, only the inputs of sin, cos, and tan are in degrees. The outputs of the inverse trigonometric functions, the hyperbolic functions, coordinate conversion, vector angles, and complex arguments are all in radians. Use the angle conversion blocks in the Unit Conversion category to switch between them.