in reply to While Loops

Wait. Stop. Take one step back and ask yourself "Why do I need to print the records 100 at a time"?

In the end there is no difference between printing the records as soon as they are read in, or waiting till the end and then printing them all at once, or anything else in between these two extremes. The end is that you have a screen (or several screens) full of data.

Output is usually buffered anyhow, so printing in "blocks" of 100 is unlikely to speed things up or make your program more performant.


A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

My blog: Imperial Deltronics