Loop control is handled with the repeat and end commands. The syntax is:
repeat n [commands to be executed] endwhere n is the number of times to repeat the loop. An inspection of the psi.dat file will show that this is how geometry optimizations and finite displacements are performed.