Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Force 4.0 Reference - exit terminate loop http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 exit                Terminate loop
------------------------------------------------------------------------------
 Syntax
   <loopstart>
      exit
   <loopend>

 Arguments
   <loopstart> is a for, do while, or repeat statement.
   <loopend> is a next, enddo, or until statement.

 Description
   The exit statement breaks out of a loop construct. Execution then
   continues at the first command following the end of the loop structure.
   The exit statement is normally placed in a conditional block within the
   loop construct.

 Example
   #define EXAMPLE_STATEMEN
   #include example.hdr

   proc Test_exit
   vardef
      uint    n
      logical lRepeated
   enddef
   n := 1                             // initialize loop control variables
   lRepeated := .f.
   do while n < 10                    // main loop control statement
      ? n                             // initial processing
      if n == 5 .and. .not. lRepeated // intermediate condition 1
         ? "Repeat"
         lRepeated := .t.             // set a loop control variable
         loop                         // restart cycle
      endif
      if lRepeated                    // intermediate condition 2
         ? "Finish"
         exit                         // leave cycle
      endif
      n++                             // continued processing
   enddo
   endproc

   proc main
   Test_exit()
   endproc

See Also: do while for loop repeat

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