| **Navigation:**  [[introduction.htm|Language Reference]] > 12 - Execution Control > Execution Control Statements >====== CYCLE (go to top of loop) ====== | [[break immediately leave loop .htm|{{btn_prev_n.gif|Previous page}}]][[introduction.htm|{{btn_home_n.gif|Return to chapter overview}}]][[do call a routine .htm|{{btn_next_n.gif|Next page}}]] | | || ** ** **CYCLE [ **//label//** ]** {{blk2blue.jpg|blk2blue.jpg}} | **CYCLE** | Transfers control back to the top of a LOOP or ACCEPT structure. | | //label// | The label on the LOOP or ACCEPT statement to which to return. This must be the label of a nested loop structure containing the CYCLE statement. | The **CYCLE** statement passes control immediately back to the top of the LOOP or ACCEPT loop. CYCLE may only be used in a LOOP or ACCEPT loop structure. The use of the optional //label// argument allows you to cleanly go back to the top of outer levels of nested loops, eliminating one common use of GOTO. In an ACCEPT loop, for certain events, CYCLE terminates an automatic action before it is performed. This behavior is documented for each event so affected: [[event iconize.htm|Event:Iconize]] [[event maximize.htm|Event:Maximize]] [[event move.htm|Event:Move]] [[event prealertkey.htm|Event:PreAlertKey]] [[event restore.htm|Event:Restore]] [[event size.htm|Event:Size]] [[event contracting.htm|Event:Contracting]] [[event expanding.htm|Event:Expanding]] [[event closedown.htm|EVENT:CloseDown]] [[event closewindow.htm|EVENT:CloseWindow]] [[dde events.htm|EVENT:DDEPoke]] [[dde events.htm|EVENT:DDEExecute]] **Example:** **    SET(MasterFile)                !Point to first record** **    LOOP                           !Process all the records** **     NEXT(MasterFile)              !read a record** **     IF ERRORCODE() THEN BREAK.    !Get out of loop at end of file** **     DO MatchMaster                !check for a match** **     IF NoMatch                    !if match not found** **     ****CYCLE****                        !jump to top of loop** **     END   ** **     DO TransVal                   !validate the transaction** **     PUT(MasterFile)               !write the record** **    END   ** **Loop1 LOOP                        !Loop1 is the label** **        DO ParentProcess** **Loop2  LOOP                       !Loop2 is the label** **        DO ChildProcess** **        IF SomeCondition** **         ****CYCLE**** Loop1              !Cycle back to top of outer loop** **        END** **       END   ** **      END   ** **See Also:** [[loop iteration structure .htm|LOOP]] [[break immediately leave loop .htm|BREAK]] [[accept the event processor .htm|ACCEPT]]