रिसर्च सर्वे: Blockly के साथ अपने अनुभव के बारे में हमें बताएं
सर्वे शुरू करें
ब्लॉकली > ब्लॉक करें > renameVarById
Block.renameVarById() तरीका
वैरिएबल का नाम बदलने की सूचना. अगर आईडी इस ब्लॉक के किसी वैरिएबल से मैच होता है, तो उसका नाम बदलें.
हस्ताक्षर:
renameVarById(oldId: string, newId: string): void;
पैरामीटर
पैरामीटर |
टाइप |
ब्यौरा |
oldId |
स्ट्रिंग |
वैरिएबल का आईडी, जिसका नाम बदला जाना है. |
newId |
स्ट्रिंग |
नए वैरिएबल का आईडी. यह पुराना आईडी जैसा ही हो सकता है, लेकिन इसका नाम अपडेट किया गया है. |
लौटाए जाने वाले प्रॉडक्ट:
अमान्य
जब तक कुछ अलग से न बताया जाए, तब तक इस पेज की सामग्री को Creative Commons Attribution 4.0 License के तहत और कोड के नमूनों को Apache 2.0 License के तहत लाइसेंस मिला है. ज़्यादा जानकारी के लिए, Google Developers साइट नीतियां देखें. Oracle और/या इससे जुड़ी हुई कंपनियों का, Java एक रजिस्टर किया हुआ ट्रेडमार्क है.
आखिरी बार 2024-09-10 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 2024-09-10 (UTC) को अपडेट किया गया."],[[["The `renameVarById` method updates a block's variable references when a variable is renamed."],["It accepts the old and new IDs of the variable, renaming the variable within the block if it's used by the block."],["This method is triggered by variable renaming events and ensures the block's internal references are consistent with the updated variable name."]]],["The `renameVarById` method within the `Block` class handles variable renaming. It checks if a provided `oldId` matches any of the block's variable IDs. If a match is found, the variable's ID is updated to the provided `newId`. The method takes two string parameters: `oldId` (the original ID) and `newId` (the updated ID) and does not return any value. This method ensures variable consistency across the block during a rename operation.\n"]]