You can insert a pagebreak anywhere, even in the middle of a program. Just click to the left of the program and select Insert|Pagebreak. You might need to add a dummy line in the for loop to keep from having a line split between 2 pages. Maybe pb <-- "pagebreak".