This is interesting, but the syntax doesn't seem to have the right expressiveness for such a large change.<p><pre><code> for recursive (Node t = tree.root; t != NULL;) {
puts(t.value);
if (t.value == target) break;
if (t.value == dontfollow) continue;
if (t.left) continue t.left;
if (t.right) continue t.right;
}
return t;
</code></pre>
Regular 'break' is to really break out of the structure like a regular for, as regular 'continue' is to do the next iteration. But if continue has a value to recurse on, it reenters the for loop like a subroutine.<p>As a bonus, I think this is tail-call-optimization friendly.