Blockly は 2025 年 11 月 10 日に Raspberry Pi Foundation に移行しました。ブログ投稿とよくある質問をご覧ください。
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
ブロックする >[ブロック] >renameVarById
Block.renameVarById() メソッド
変数名の変更に関する通知。ID がこのブロックの変数のいずれかと一致する場合は、名前を変更します。
署名:
renameVarById(oldId: string, newId: string): void;
パラメータ
| パラメータ |
型 |
説明 |
| oldId |
文字列 |
名前を変更する変数の ID。 |
| newId |
文字列 |
新しい変数の ID。oldId と同じでも、名前を更新したものになります。 |
戻り値:
void
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-07-25 UTC。
[null,null,["最終更新日 2025-07-25 UTC。"],[],["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"]]