透過集合功能整理內容
你可以依據偏好儲存及分類內容。
blockly > IVariableMap > createVariable
IVariableMap.createVariable() 方法
建立具有指定名稱的新變數。如果未指定 ID,變數對應應建立一個 ID。傳回新變數。
Signature:
createVariable(name: string, id?: string, type?: string | null): T;
參數
參數 |
類型 |
說明 |
名稱 |
字串 |
|
id |
字串 |
(選用) |
類型 |
string | null |
(選用) |
退貨:
T
除非另有註明,否則本頁面中的內容是採用創用 CC 姓名標示 4.0 授權,程式碼範例則為阿帕契 2.0 授權。詳情請參閱《Google Developers 網站政策》。Java 是 Oracle 和/或其關聯企業的註冊商標。
上次更新時間:2025-07-25 (世界標準時間)。
[null,null,["上次更新時間:2025-07-25 (世界標準時間)。"],[],[],null,["[blockly](./blockly.md) \\\u003e [IVariableMap](./blockly.ivariablemap_interface.md) \\\u003e [createVariable](./blockly.ivariablemap_interface.createvariable_1_methodsignature.md)\n\nIVariableMap.createVariable() method\n------------------------------------\n\nCreates a new variable with the given name. If ID is not specified, the variable map should create one. Returns the new variable.\n\n**Signature:** \n\n createVariable(name: string, id?: string, type?: string | null): T;\n\nParameters\n----------\n\n| Parameter | Type | Description |\n|-----------|----------------|--------------|\n| name | string | |\n| id | string | *(Optional)* |\n| type | string \\| null | *(Optional)* |\n\n**Returns:**\n\nT"]]