Stay organized with collections
Save and categorize content based on your preferences.
blockly > Block > setCommentText
Set this block's comment text.
Signature:
setCommentText(text: string | null): void;
Parameters
Parameter |
Type |
Description |
text |
string | null |
The text, or null to delete. |
Returns:
void
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-18 UTC.
[[["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 2024-09-18 UTC."],[[["\u003cp\u003eThe \u003ccode\u003esetCommentText()\u003c/code\u003e method allows you to modify or remove the comment associated with a specific block.\u003c/p\u003e\n"],["\u003cp\u003eIt accepts a single parameter, \u003ccode\u003etext\u003c/code\u003e, which can be a string containing the new comment or \u003ccode\u003enull\u003c/code\u003e to delete the existing comment.\u003c/p\u003e\n"],["\u003cp\u003eCalling this method updates the block's comment without returning any value.\u003c/p\u003e\n"]]],["The `setCommentText()` method, part of the `Block` class, sets a block's comment text. It accepts a single parameter, `text`, which can be a string or `null`. Providing a string value sets the comment text, while `null` deletes any existing comment. The method returns `void`, indicating it doesn't return any value.\n"],null,["[blockly](./blockly.md) \\\u003e [Block](./blockly.block_class.md) \\\u003e [setCommentText](./blockly.block_class.setcommenttext_1_method.md)\n\nBlock.setCommentText() method\n-----------------------------\n\nSet this block's comment text.\n\n**Signature:** \n\n setCommentText(text: string | null): void;\n\nParameters\n----------\n\n| Parameter | Type | Description |\n|-----------|----------------|------------------------------|\n| text | string \\| null | The text, or null to delete. |\n\n**Returns:**\n\nvoid"]]