While Loop

Wondering if anyone has an example of doing a "while" or "until" type of loop.

I have a table that I scrape from multiple pages. On each page it has a different number of rows. I'd like to extract each row.

I see that I can't use a sub-extraction pattern, but need to run a manual instead.

I'm just not experienced enough with this to follow the example of manual extraction.

For manual extraction, I

For manual extraction, I usually use a 'for' loop.

prods = scrapeableFile.extractData( productDescriptionText, "PRODUCT");
countResults = prods.getNumDataRecords();
session.log("Found " + countResults + " products");

for (i=0; i<countResults; i++)
{
        session.log("Extracting result " + i + " of " + countResults);
        prodSet = prods.getDataRecord(i);

        prod = prodSet.get("PRODUCT");
        price = prodSet.get("PRICE");
}

If you need a while, I have one where a script checks the date on each posting, and if the date is older than 30 days, it sets CONTINUE to false.
while (session.getv("CONTINUE") && !session.shouldStopScraping())
{
        session.addToVariable("PAGE", 1);
        session.log("+++Starting page " + session.getv("PAGE"));
        session.scrapeFile("Search results");
}