There was something about this in the Wrox certification book which unfortunately I don't have with me. I didn't really understand it then and it puzzled me in the same way it has Mike. At the time I just kept on reading and figured I'd come back to it at another time. I guess the time is now.
I wish I had time to
test it right now but I don't. So I'm just going to add some questions. It looks to me like the translation puts in begin and end code brackets if you don't. But unless the next line is template text it puts those brackets on the same line as the iteration code. So we get:
if the next line is not template text.
But if the next line is template text then we get
and so we get the iteration results that we expect.
That's anyway the way it looks to me. If I had time I'd test the following:
I'm betting that in this instance we would get the intended iteration and java would print 10 times.
In any case it's an interesting question and I hope someone can clarify it.
Ken