if y lt 0 then begin t=2 txt='Negative' endif
if y lt 0 then begin t=2 txt='Negative' endif else begin t=3 txt='Non-negative' endelse
for ix=0L, n, 10 do begin x(j) = xx(ix) j = j+1 print,ix endfor
A for loop may be executed 0 times if the loop variable starts beyond the loop limit.
while not eof(lun) do begin readf,lun,txt print,txt endwhile
repeat begin readf, lun, x x = x-c endrep until x le 0
case expression of expression: statement . . . expression: statement else: statement endcase
case animal of 'cat': print,'meow' 'dog': print,'arf arf' 'bird': print,'tweet tweet' else: print,'??' endcase
case t>0<2 of 0: begin txt = 'red' err = 0 end 1: begin txt = 'green' err = 0 end 2: begin txt = 'blue' err = 1 end endcase
. . . loop: . . . goto, loop
. . . goto, err . . . err: print,' Error ...' . . .
begin statement 1 . . . statement n end
name is the name of the common block. Variables are matched by position so need not have the same name in each routine.
Several routines may use a common to share status values. In such cases it is useful to store the common in a separate file and include it in each routine (@filename where @ is in column 1). This way only a single copy of the common need be maintained.
A good way to name commons is to use the main routine name followed by _com, like xkodak_com. This helps prevent the accidental use of the same name for diffrent commons.
name is the name of the procedure.
Example calls to the above procedures:
test, 2, 3, out
compute, x, y, z, /flag
name is the name of the function.
Example calls to the above procedures:
a = test(2, 3, 5)
t = compute(x, y, z, /flag)