forlang.hlp (Table of Contents; Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software, purely for historical purposes. If you're looking for up-to-date documentation, particularly for programming, you should not rely on the information found here, as it will be woefully out of date.
CYCLE
                                             Up Contents Index Back
─────CYCLE──────────────────────────────────────────────────────────────────
 
     Action
 
     Within a loop, advances control to the terminating statement of a
     DO or DO WHILE loop.
 
     Syntax
 
     CYCLE
 
     Remarks
 
     The CYCLE statement skips over the remaining part of a DO or
     DO WHILE loop.
 
     Example
 
     Suppose you wanted to print a table of relativistic time-dilation
     factors for every velocity from 0 to the speed of light, in steps
     of 100 km/second. Perhaps you do not want to calculate these
     factors for speeds less than 10 percent of the speed of light.
     The following example computes the time-dilation factors
     accordingly, putting them in the array timedilation. You can use
     the WRITE statement to print out the array. ___________
     Time-dilation factor: 1 / √ 1 - (v/c)²
 
           INTEGER sub        ! subscript for timedilation array
           REAL timedilation(0:300)
           speedolight = 300000e3        ! 300000 km per second
           speedstep = 100e3             ! 100 km per second
 
           sub = speedolight / speedstep
           DO velocity = 1, speedolight, speedstep
              timedilation(sub) = 1.0
              IF (velocity .LT. (0.1 * speedolight))   CYCLE
              timedilation(sub) =
          +   1.0 / SQRT (1.0 - (velocity / speedolight)**2)
           END DO
                                    -♦-