The case of the While loop that didn’t evaluate

In this case, an ICE While loop wasn’t working as expected.
The customer was using Max Repeat to do something like this, but in ICE:

x = 2
cond = x > 0

i = 0
while cond:
	print i
	i = i + 1
	if i > 10: break

Unfortunately, in ICE, the While loop was never executed.

It’s not a problem with the While loop, it’s a problem with the ICE tree evaluation (it’s a bit too lazy). I’ve seen things like this before, and I usually create a separate ICE tree to workaround it:

On the mailing list, Guillaume suggested a couple of other workarounds. First, use Delay Set Data.
The word “Delay” in the node name throws me off…I wouldn’t think to use it, but after reading up on it, I can see why you would think to use that node (it does evaluation).

If you set the condition boolean in the While loop, that works too: