Skip to main content

Home > 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): IVariableModel<IVariableState> | null;

Parameters

ParameterTypeDescription
namestringThe name to check for.
opt_typestring(Optional) The type of the variable. If not provided it defaults to the empty string, which is a specific type.

Returns:

IVariableModel<IVariableState> | null

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