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 - loop restart loop http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 loop                Restart loop
------------------------------------------------------------------------------
 Syntax
   <loopstart>
      loop
   <loopend>

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

 Description
   The loop statement causes processing commands at the top of the
   loop construct's command block.

   When used with do while, the loop statement evaluates the logical
   expression, and if it is true, executes the command block again,
   starting with the first command after the do while statement.

   When used with repeat/until, loop evaluates the terminating logical
   expression, and if it is false, executes the command block again,
   starting with the first command after the repeat keyword.

   In a for/next construct, loop increments or decrements the integer
   loop counter, checks its value against the terminating integer
   value, and if the equality test is false, begins processing commands
   at the first command after the for statement.

 Example
   #define EXAMPLE_STATEMEN
   #include example.hdr

   proc Test_loop
   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_loop()
   endproc

See Also: do while exit for repeat

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