On 5/16/06, David Wheeler <[EMAIL PROTECTED]> wrote:
On May 16, 2006, at 16:30, Andrew Dunstan wrote:

> It ought to be illegal to modify the loop control variable anyway,
> IMNSHO - it certainly is in Ada, the distant antecedent of pl/pgsql.

I agree, but I must say that it's incredibly useful to be able to
increment by two as I go through a loop:

     FOR i IN 1 + offset .. 11 + offset LOOP
         total := total + substring(ean, i, 1)::INTEGER;
         i = i + 1;
     END LOOP;

Best,

David


i have posted a patch to add a BY clause to the for statement (integer
version), with the BY clause you can specify an increment value...

it's in the unapplied patches list waiting for review...

http://candle.pha.pa.us/mhonarc/patches/msg00003.html

--
regards,
Jaime Casanova

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs and the universe trying
to produce bigger and better idiots.
So far, the universe is winning."
                                      Richard Cook

---------------------------(end of broadcast)---------------------------
TIP 3: Have you checked our extensive FAQ?

              http://www.postgresql.org/docs/faq

Reply via email to