Stay organized with collections Save and categorize content based on your preferences.

blockly > VariableMap > getVariable

VariableMap.getVariable() method

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

Signature:

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

Parameters

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

Returns:

VariableModel | null

The variable with the given name, or null if it was not found.