blockly > Block > getChildren
Block.getChildren() method
Find all the blocks that are directly nested inside this one. Includes value and statement inputs, as well as any following statement. Excludes any connection on an output tab or any preceding statement. Blocks are optionally sorted by position; top to bottom.
Signature:
getChildren(ordered: boolean): Block[];
Parameters
Parameter |
Type |
Description |
ordered |
boolean |
Sort the list if true. |
Returns:
Block[]
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.
[null,null,["Last updated 2024-09-18 UTC."],[[["The `getChildren()` method retrieves all directly nested blocks within the current block, including those in value and statement inputs."],["This method excludes connections on output tabs and preceding statements."],["It returns an array of blocks, optionally sorted by position based on the `ordered` parameter."]]],["The `Block.getChildren()` method retrieves an array of blocks directly nested within a given block. It includes blocks connected to value and statement inputs, and any following statements, but excludes blocks connected to output tabs or preceding statements. The method accepts a boolean parameter, `ordered`, to determine if the returned list of blocks should be sorted by position from top to bottom. The method returns an array of `Block` objects.\n"]]