Leave an outer loop from an inner loop

[Autolink] Menu

 
/* 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 */


[Back: Get a line number at runtime - 2 -]
[Next: Call another REXX program (OS/2 v2.1)]