Multiple next() steps in a traversal

Is there a way to exit traversals at different steps? I tried using the next() step on a static, but it failed.
Was this page helpful?