; __________________________________________________________________ ; ; MODEL5.PRO ; The name of this program, should I forget it. ; __________________________________________________________________ ; PRO MYFIRSTSUBROUTINE,T,F,V ; INPUT: T and F, OUTPUT: V ; V=0.D0*F ; v(f) and f have the same length; FOR A=0,N_ELEMENTS(F)-1 DO BEGIN ; Loop calculating v(f) begins V(A)=TOTAL(COS(2.D0*!PI*F(A)*T)) ; ENDFOR & PRINT,V ; Loop -"- ends ABC='I do not exist in main program'; Not INPUT or OUTPUT ! RETURN & END ; Subroutine ends ; __________________________________________________________________ ; ; ; MAIN PROGRAM BEGINS X=2.D0*!PI*FINDGEN(50) ; Input T and F names irrelevant! Y=11.+FINDGEN(10) ; Output V name irrelevant! MYFIRSTSUBROUTINE,X,Y,Z ; 1st use of subroutine ; __________________________________________________________________ ; A=COS(Z*7.D0) & B=SIN(X/90.D0) ; MYFIRSTSUBROUTINE,A,B,C ; 2nd use of subroutine PRINT,ABC ; Here the program fails. Why? END ; __________________________________________________________________ ;