Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

doubt GOTO statment

boobalan_c
Beginner
668 Views
pls any one help me.

Iam coverting a fortran system into java.I want to know some thing about GOTO statement.my doubt is from a if loop, i want to jump to a set a statement, so iam providing a GOTO statement there with that particular set of statements line number.after executing the set of statement whether the control send back to the if statement or i will continue the flow after the set of statement.with out any other statament like return or GOTO.

thanks
0 Kudos
3 Replies
TimP
Honored Contributor III
668 Views
I'm not entirely clear on your question. An example might help. FortranGOTO is not like a BASIC GOSUB. In order for program flow to return to the site of a GOTO, another GOTO would be required. At one time the Fortran standard permitted resumption of a DO loop in this way, but that capability has long since been removed from the standard. As modern compilers have facilities for interprocedural expansion of subroutine calls, there should not be any performance incentive for the kind of code you may be talking about.
0 Kudos
Steven_L_Intel1
Employee
668 Views
Once you jump out of an IF or DO with a GOTO, you are not allowed to jump back in. The statements you jump to execute normally, there is no "end" other than the end of the program or routine.
If you want some set of statements executed and then control returned, use CALL or a function reference.
0 Kudos
boobalan_c
Beginner
668 Views
Thanks for your replies. i got my answer from your replies.

thanks you,
boobalan.c
0 Kudos
Reply