Stay organized with collections
Save and categorize content based on your preferences.
blockly > Block > getCommentText
Returns the comment on this block (or null if there is no comment).
Signature:
getCommentText(): string | null;
Returns:
string | null
Block's comment.
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\u003eThis method returns the text content of a comment associated with a specific block.\u003c/p\u003e\n"],["\u003cp\u003eIf the block doesn't have a comment, the method will return null instead of a string.\u003c/p\u003e\n"],["\u003cp\u003eThe method signature indicates it takes no input and returns either a string (the comment) or null.\u003c/p\u003e\n"]]],["The `Block.getCommentText()` method retrieves the text of a comment associated with a block. It returns a string containing the comment's content if a comment exists. If no comment is present, the method returns `null`. This method's output is either a string or a null value, specifically representing the block's comment text.\n"],null,["[blockly](./blockly.md) \\\u003e [Block](./blockly.block_class.md) \\\u003e [getCommentText](./blockly.block_class.getcommenttext_1_method.md)\n\nBlock.getCommentText() method\n-----------------------------\n\nReturns the comment on this block (or null if there is no comment).\n\n**Signature:** \n\n getCommentText(): string | null;\n\n**Returns:**\n\nstring \\| null\n\nBlock's comment."]]