blockly > Workspace > getVariable

Workspace.getVariable() method

Find the variable by the given name and return it. Return null if not found.


getVariable(name: string, opt_type?: string): VariableModel | null;


Parameter Type Description
name string The name to check for.
opt_type string (Optional) The type of the variable. If not provided it defaults to the empty string, which is a specific type.


VariableModel | null

The variable with the given name.