Why does this iterator fail to update correctly?

In the first case, you use the value m.trange to create mnew, and m.trange never changes (in your example it is always 3), because m always refers to the original MyInterval instance.

In the second case, you use the value state instead of m.trange. The state changes with every iteration.

1 Like