Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- The Guide To Clipper - <b>do while</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
DO WHILE


Syntax:     DO WHILE <condition>
               <statements>...
               [EXIT]
               <statements>...
               [LOOP]
               <statements>...
            ENDDO

Purpose:    To repeatedly execute a series of statements while a
            condition is true (.T.).

Argument:   <condition> is the controlling condition evaluated
            whenever the DO WHILE statement executes.

Options:    Exit: The EXIT statement unconditionally branches
            control from within a DO WHILE or FOR...NEXT structure to
            the statement immediately following the ENDDO or NEXT
            statement.

            Loop: The LOOP statement branches control to the most
            recently executed DO WHILE or FOR...NEXT statement.

Usage:      The DO WHILE control structure executes a block of
            statements repetitively as long as the specified condition
            evaluates to true (.T.).  When the condition evaluates to
            true (.T.), control passes into the structure and proceeds
            until an EXIT, LOOP, or ENDDO is encountered.  ENDDO returns
            control to the DO WHILE statement and the process repeats
            itself.

            If the condition evaluates to false (.F.), the DO WHILE
            construct terminates and control passes to the statement
            immediately following the ENDDO.

            Exiting: EXIT is used generally when you want to
            terminate a DO WHILE structure based on a condition other
            than the DO WHILE condition.

            Looping: LOOP is generally used where you want to
            prevent execution of statements within a DO WHILE based on
            an intermediate condition and branch immediately back to the
            DO WHILE command line.  For example:

            DO WHILE <condition>

               <initial processing>...

               IF <intermediate condition>
                  LOOP
               ENDIF

               <continued processing>...

            ENDDO

            Repeat until: The following demonstrates the use of DO
            WHILE to create a repeat until looping construct:

            more = .T.
            DO WHILE more
               <statements>...
               more = (<condition>)
            ENDDO

            Traversing a database file: The following two examples
            demonstrate the looping construct to move sequentially
            through a database file.

            DO WHILE .NOT. EOF()
               <statements>...
               SKIP
            ENDDO


            This example sequentially scans a database file processing
            records that match a condition.

            LOCATE FOR <condition>
            DO WHILE FOUND()
               <statements>...
               CONTINUE
            ENDDO

            Macros on the DO WHILE command line: Macro variables can
            comprise all or part of the DO WHILE condition without
            limitation.

            Note that like all other control structures, only the first
            three characters of the END statement are significant.  END
            is also a reserved word and should not be used when naming
            memory variables.

Library:    CLIPPER.LIB

See Also: BEGIN SEQUENCE DO CASE FOR...NEXT IF RETURN

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson