Goto/exit/cycle in FORTRAN

Source: Internet
Author: User

1, Goto
Goto has been circulated in FORTRAN77, which provides a random jump to the position of the code of the assigned row. If it is in a do loop
Do 30 I = 1, n
If (......) Goto 30
30 continue
The preceding statement indicates that if the condition in IF is met, the next loop is performed.

2, pause
The pause function can be the same as its literal meaning. When the program is executed to pause, the execution will be paused until the user presses enter.

3. Continue
The continue command has no actual purpose. Its function is to continue to execute the program

4, stop
It can be used to end program execution.

5, cycle
The cycle Command performs the next loop by directly jumping back to the beginning of the loop of all program code after the cycle command in the program module that has skipped the loop.
For example
Do floor = 1, dest
If (floor = 4) cycle
Write (*, *) Floor
End do

The execution result is as follows:
1
2
3
5
6
......

6. Exit
The exit function can directly jump out of an ongoing loop, whether it is a do loop or a do while loop.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.