[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-05-16 UTC."],[[["\u003cp\u003eThe \u003ccode\u003egetVariable\u003c/code\u003e method searches for a variable within the workspace using its name and optional type.\u003c/p\u003e\n"],["\u003cp\u003eIt returns the \u003ccode\u003eVariableModel\u003c/code\u003e of the matching variable or \u003ccode\u003enull\u003c/code\u003e if no such variable exists.\u003c/p\u003e\n"],["\u003cp\u003eWhen providing the optional type, omitting it or using an empty string is considered a specific type.\u003c/p\u003e\n"]]],[],null,["[blockly](./blockly.md) \\\u003e [Workspace](./blockly.workspace_class.md) \\\u003e [getVariable](./blockly.workspace_class.getvariable_1_method.md)\n\nWorkspace.getVariable() method\n------------------------------\n\n\u003e | **Warning:** This API is now obsolete.\n\u003e\n\u003e v12: use Blockly.Workspace.getVariableMap().getVariable.\n\nFind the variable by the given name and return it. Return null if not found.\n\n**Signature:** \n\n getVariable(name: string, opt_type?: string): IVariableModel\u003cIVariableState\u003e | null;\n\nParameters\n----------\n\n| Parameter | Type | Description |\n|-----------|--------|-------------------------------------------------------------------------------------------------------------------|\n| name | string | The name to check for. |\n| opt_type | string | *(Optional)* The type of the variable. If not provided it defaults to the empty string, which is a specific type. |\n\n**Returns:**\n\n[IVariableModel](./blockly.ivariablemodel_interface.md)\\\u003c[IVariableState](./blockly.ivariablestate_interface.md)\\\u003e \\| null\n\nThe variable with the given name."]]