The assigned GO TO is an old branching construct in FORTRAN. It utilizes the ability in FORTRAN to store statement labels inside INTEGER variables that is provided by the assign statement. It does this by branching to the statement label that is stored inside of the INTEGER variable that follows the go to statement. This construct is no longer common and its use should be avoided (it has been formally declared obsolete, though still permitted in the Fortran 90 standard).
The only real restriction on the use of this statement is that it can not appear as the termination statement of a do or do while loop. Otherwise, it can appear anywhere in a program after all of the non executable statements ( type declarations, use statements ect..) are finished. The following is an example of the combined use of ASSIGN and GO TO:
integer iword assign 1000 to iword go to iword 1000 write *, 'iword is assigned to statement label 1000'
Naturally, in a real program there would probably be numerous lines of FORTRAN appearing between the each of the above lines. However, you should get the general idea of how the assigned GO TO works.
There is one other thing that you should be careful of when using this statement. If you place an integer variable that has integer value stored in it and not a statement label after the go to statement, then it is anybody's guess as to where in your program it will branch. It is potential errors like this one that have made the assigned go to an unpopular construct in FORTRAN. It is generally found only in very old programs and you should never use it in a new program.
Written by Jason Wehr: firstname.lastname@example.org and Maintained by John Mahaffy : email@example.com