
- Fortran - Home
- Fortran - Overview
- Fortran - Environment Setup
- Fortran - Basic Syntax
- Fortran - Data Types
- Fortran - Variables
- Fortran - Constants
- Fortran - Operators
- Fortran - Decisions
- Fortran - Loops
- Fortran - Numbers
- Fortran - Characters
- Fortran - Strings
- Fortran - Arrays
- Fortran - Dynamic Arrays
- Fortran - Derived Data Types
- Fortran - Pointers
- Fortran - Basic Input Output
- Fortran - File Input Output
- Fortran - Procedures
- Fortran - Modules
- Fortran - Intrinsic Functions
- Fortran - Numeric Precision
- Fortran - Program Libraries
- Fortran - Programming Style
- Fortran - Debugging Program
Fortran - Cycle Statement
The cycle statement causes the loop to skip the remainder of its body, and immediately retest its condition prior to reiterating.
Flow diagram

Example
program cycle_example implicit none integer :: i do i = 1, 20 if (i == 5) then cycle end if print*, i end do end program cycle_example
When the above code is compiled and executed, it produces the following result −
1 2 3 4 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
fortran_loops.htm
Advertisements