Is there a way to "jump over" once loop? something like the "continue" keyword in Python.

Is there a way to "jump over" once loop? something like the "continue" keyword in Python.

g2m.agent
Collaborator Collaborator
368 Views
1 Reply
Message 1 of 2

Is there a way to "jump over" once loop? something like the "continue" keyword in Python.

g2m.agent
Collaborator
Collaborator
for i in some_array:
    if i==0:
        continue
    # do something that i not equal 0.

 

 

 

Accepted solutions (1)
369 Views
1 Reply
Reply (1)
Message 2 of 2

Grahame_Fuller
Autodesk
Autodesk
Accepted solution

Hi,

 

Connect your array to a for_each compound. Inside that, right-click and make the array connection into an iteration target. Delete the max_iterations port (or set it to a large number). Use an if node to test whether the current value from the array is 0. If it is, pass it through unchanged. Otherwise, change it in some way.

 

test-value-in-for-each.png

 

I hope that helps,

gray

 

 


Grahame Fuller
Learning Content Developer