blockly > CodeGenerator > statementToCode

CodeGenerator.statementToCode() method

Generate a code string representing the blocks attached to the named statement input. Indent the code. This is mainly used in generators. When trying to generate code to evaluate look at using workspaceToCode or blockToCode.

Signature:

statementToCode(block: Block, name: string): string;

Parameters

Parameter Type Description
block Block The block containing the input.
name string The name of the input.

Returns:

string

Generated code or '' if no blocks are connected.