סקר מחקר: נשמח לשמוע על החוויה שלך עם Blockly
לפתיחת הסקר
blockly > חסימה > renameVarById
שיטת Block.renameVarById()
התראה על כך ששינוי שם של משתנה. אם המזהה תואם לאחד מהמשתנים של הבלוק הזה, משנים את השם שלו.
Signature:
renameVarById(oldId: string, newId: string): void;
פרמטרים
פרמטר |
סוג |
תיאור |
oldId |
מחרוזת |
מזהה המשתנה שרצית לשנות את השם שלו. |
newId |
מחרוזת |
המזהה של המשתנה החדש. יכול להיות זהה ל-oldId, אבל עם שם מעודכן. |
החזרות:
ריק
אלא אם צוין אחרת, התוכן של דף זה הוא ברישיון Creative Commons Attribution 4.0 ודוגמאות הקוד הן ברישיון Apache 2.0. לפרטים, ניתן לעיין במדיניות האתר Google Developers. Java הוא סימן מסחרי רשום של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 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"]]