Although the Pascal for statement looks a bit different than the Java for statement, they are quite the same. The Pascal for statement can be in one of the two following forms:
for control := initial to final do (body)
or:
for control := initial downto final do (body)
The corresponding Java versions are:
for( control = initial ; control < final ; control ++) (body)
and:
for( control = initial ; control > final ; control --) (body)
The bytecode for the for statement is structured as follows:
This can also be compiled using the same techniques as for the while statement.