GOTO - Unconditional

Statement: Transfers control to the same branch target statement every time it executes.

Syntax

GO TO label

label

Is the label of a valid branch target statement in the same scoping unit as the GO TO statement.

The unconditional GO TO statement transfers control to the branch target statement identified by the specified label.

Example

The following are examples of GO TO statements:

GO TO 7734

GO TO 99999

The following shows another example:

integer(2) in

10 print *, 'enter a number from one to ten: '

read *, in

select case (in)

case (1:10)

exit

case default

print *, 'wrong entry, try again'

goto 10

end select

See Also