[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Advanced Programming Structures



Hi gang!  I just came across a few notes from a programming class that I
taught a decade or so ago.  Check this out:

DO
    .
    .
    .
LOOP UNTIL X<>0

is the same as

FOR II = 0 TO 1
    .
    .
    .
    II=1
    IF X=0 THEN II=0
    IF Y=0 THEN II=9
    IF Y=99 THEN II=10
NEXT II
IF II=10 THEN PRINT "AT BOTTOM"
IF II=11 THEN PRINT "AT TOP"

Neat, eh?  A controlled loop w/o any GOTOs needed *AND* exit codes to boot!

--


Keith Olson

  ---------------------------------------------------------------------
 |   For the memory of the uncompromisingly righteous is a blessing,   |
 |                                                    Proverbs 10:7a   |
  ---------------------------------------------------------------------