IRAF help page for package language, program goto

from NOAO goto -- branch to a labelUSAGEPARAMETERSDESCRIPTIONEXAMPLESBUGSSEE ALSO

goto -- branch to a label


USAGE

goto label
  .
  .
  .
label: statement

PARAMETERS

PARAMETERS

label

The destination label. Label names have the same syntax as variable names and can duplicate the names of existing variables.

statement

The statement executed after the goto statement. It may be any executable statement.


DESCRIPTION

The goto statement interrupts the normal flow of program execution by transferring control to the statement following the label. It may also be used to exit from nested loops where the break statement is not adequate.


EXAMPLES

1. The most common use of the goto statement is to branch to an error handler if an abnormal condition is detected.

begin
	for (i=1;  i <= 100;  i += 1)
	    for (j=1;  j <= 100;  j += 1)
		for (k=1;  k <= 100;  k += 1)
		    if (pixel[i,j,k] < 0)
			goto err
		    else
			total += pixel[i,j,k]
	print ("total = ", total)
	return
err:
	print ("Invalid pixel value at ",i,j,k)
end

BUGS

BUGS No checking is done to see if a jump is made into a loop.


SEE ALSO

break, next,


This page automatically generated from the iraf .hlp file. If you would like your local iraf package .hlp files converted into HTML please contact Dave Mills at NOAO.

dmills@noao.edu