Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP Fortran Compiler for HP-UX: HP Fortran Programmer's Reference > Chapter 10 HP Fortran statements

GO TO (computed)

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Glossary

 » Index

Transfers control to one of several labels.

Syntax

GO TO ( label-list ) [,] arithmetic-expression
label-list

is a list of statement labels, separated by commas.

arithmetic-expression

is a scalar integer expression. As an extension, HP Fortran also allows the expression to be of type real or double precision.

Description

The computed GO TO statement transfers control to one of several labeled statements, depending on the value of arithmetic-expression. After arithmetic-expression is evaluated (and, if necessary, truncated to an integer value), control transfers to the statement label whose position in label-list corresponds to the truncated value of arithmetic-expression.

If the value of arithmetic-expression is less than 1 or greater than the total number of labels in label-list, control transfers to the executable statement immediately following the computed GO TO statement.

Examples

index = 3
! Branch made to the statement labeled 30.
GO TO (10, 20, 30, 40) index

Related statements

SELECT CASE, GO TO (assigned), and GO TO (unconditional)

Related concepts

For information about flow control statements, see “Flow control statements”.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© Hewlett-Packard Development Company, L.P.