blockly > Block > getParent
Block.getParent() method
Return the parent block or null if this block is at the top level. The parent block is either the block connected to the previous connection (for a statement block) or the block connected to the output connection (for a value block).
Signature:
getParent(): this | null;
Returns:
this | null
The block (if any) that holds the current block.
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.
[null,null,["Last updated 2024-09-18 UTC."],[[["The `getParent()` method retrieves the parent block of the current block within a Blockly workspace."],["If the current block is at the top level and has no parent, the method returns `null`."],["Parent blocks are determined by connections: previous connection for statement blocks and output connection for value blocks."]]],[]]