I am trying to access the inner/inline blocks used as input to another block. Problem is, when I use .getChildren, it doesn't seem to keep track of what is in a specific spot. For instance, if I start with the blocks below,
The num block with 3 in it is in position 0 of the array, and the 'if' block is in position 1. So I can initially access the inline block with block.getChildren()[0].type
However, if I put in a different block in place of the num block:
it shifts the array so that the 'if' block is now in position 0, and the new block, the inline block, is in position 1. So now, block.getChildren()[0].type returns the .type of the 'if' block.
How do I get whatever block is attached in a specific spot? I need to be able to identify the inner blocks that don't get highlighted when the block it is attached to does get highlighted. It needs to be able to tell if there is an operation block vs a num block etc. and log it into the console. Even if I loop through the array, it doesn't help if the index of that spot keeps changing because I can't use the index to figure out where that block is at.
Below is an example of my code if it helps: