[Toc][Index]

Leave an outer loop from an inner loop





 
/* code sequence showing a technique to leave an outer loop in        */
/* an inner loop                                                      */

  do i=1 until 1=0              /* i is a dummy variable for the      */
                                /* leave command                      */
                                /* UNTIL 1=0 simulates "FOREVER"      */
    do j=4 to 45
      r = 1
      do while ( r.j <> t.j )
        r = r + 1
        if r.j = "EXIT" then
          leave i               /* abort the UNTIL loop               */
      end /* do while ( r.j <> t.j ) */
    end  /* do j=4 to 45 */
  end /* do i=1 UNTIL 1=0 */

  

Created using Inf-PHP v.2 (c) 2003 Yuri Prokushev
Created using Inf-HTML v.0.9b (c) 1995
Peter Childs