blockly > Block > getSurroundParent
Block.getSurroundParent() method
Return the parent block that surrounds the current block, or null if this block has no surrounding block. A parent block might just be the previous statement, whereas the surrounding block is an if statement, while loop, etc.
Signature:
getSurroundParent(): this | null;
Returns:
this | null
The block (if any) that surrounds 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 `getSurroundParent()` method identifies and returns the parent block that encloses the current block, rather than just the preceding statement."],["If the block is not nested within a surrounding block like an \"if\" statement or loop, the method returns null."],["This method is useful for understanding the structural context of a block within a larger program."]]],[]]