; The start of every program must be preceeded by "PRO" and the file name must end in .pro
PRO align
JMAX = 80
EX = 0.0
DEX = 0.1
; Arrays must be declared as to the type of values they contain as well as how many elements in each dimension
; I believe floats are precise to the 6th decimal point, perhaps not as precise as a real in fortran.  If necessary use a
; DblArr() instead of the FltArr().
Y1 = FLTARR(JMAX)
Y2 = FLTARR(JMAX)
Y3 = FLTARR(JMAX)
Y4 = FLTARR(JMAX)
Y5 = FLTARR(JMAX)
XP = FLTARR(JMAX)

; This is a for loop which seems to be a cross between C and Fortran syntax.
; IMPORTANT:  IDL is like C in that it the 1st element is numbered "0",  so the loop must only go to JMAX-1
FOR j = 0,JMAX-1 DO BEGIN
X1=EX
X2=EX/2
X3=EX/3
X4=EX/4
X5=EX/5
Y1[j]=X1*(2+X1)/((1+X1)*(1+X1))
Y2[j]=X2*(2+X2)/((1+X2)*(1+X2))
Y3[j]=X3*(2+X3)/((1+X3)*(1+X3))
Y4[j]=X4*(2+X4)/((1+X4)*(1+X4))
Y5[j]=X5*(2+X5)/((1+X5)*(1+X5))
XP[j]=EX
EX = EX + DEX
; Here I have put in just a couple of print statements to assure myself that the program is working properly
; Note the syntax, like all in IDL, is a comma after the command, then the variable to be acted upon.
; Multiple variables can be strung together with commas, but they won't start a newline that way.
print, j
print, XP
print, ' '   ; There may be a better way, but I forced a line skip by printing a string with nothing but a space in it
ENDFOR

; Now we actually plot the arrays.  In this case, XPis plotted on the X axis, and Y1 is on the Y axis.
: Remember that the dollar sign is used to indicate this in one giant statement.
PLOT, XP, Y1, \$
XTITLE = 'INCIDENT ENERGY (EV)', \$   ; This is the x axis label
YTITLE = 'T TO V EFFICIENCY', \$           ; This is the y axis label
PSYM = 0, \$   ; PSYM is the plotting symbol.  In this case, there it is a line with no individual points.
XSTYLE = 1, XRANGE = [0,8], \$                ; The x axis is forced to the value specified in XRange
YSTYLE = 1, YRANGE = [0,1], \$                ; The y axis is forced to the value specified in YRange
XTICKS = 4, XMINOR = 10, \$                     ; There are 4 units between the XRange 0-8, i.e. ending at 2,4,6,&8
YTICKS = 10, \$                                              ; The Y axis does not have minor tick marks between the majors
CHARSIZE = 1                                               ; A character size of 1 is the default and does not need to be specified

OPLOT, XP, Y2                 ; This command overlays another plotted line over the first one
OPLOT, XP, Y3
OPLOT, XP, Y4
OPLOT, XP, Y5

; I have removed the print command from this program to keep it simple.  Look at the other examples of how to print

END