Stay organized with collections
Save and categorize content based on your preferences.
blockly > Block > getDescendants
Block.getDescendants() method
Find all the blocks that are directly or indirectly nested inside this one. Includes this block in the list. Includes value and statement inputs, as well as any following statements. Excludes any connection on an output tab or any preceding statements. Blocks are optionally sorted by position; top to bottom.
Signature:
getDescendants(ordered: boolean): this[];
Parameters
Parameter |
Type |
Description |
ordered |
boolean |
Sort the list if true. |
Returns:
this[]
Flattened array of blocks.
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."],[],["The `Block.getDescendants()` method retrieves all blocks nested within a given block, including the block itself. It encompasses blocks connected to value and statement inputs, and subsequent statements, while excluding those on output tabs or preceding statements. The method accepts an optional boolean parameter, `ordered`, to sort the resulting list of blocks by their position (top-to-bottom). It returns a flattened array of the descendant blocks.\n"]]