An IDL main program requires a .RUN command to run, and the code within that file starts executing after successful compilation.
An IDL procedure is a kind of subroutine and has something like
PRO PROCEDURE_NAME, PARAM1, PARAM2
at the top of the file. The variables in the procedure definition can be input
or output. It is possible to have keywords with a command like
PRO PROCEDURE_NAME, KEY1=KEY1, KEY2=KEY2
It can be executed with a command like:
IDL> procedure_name, a, b
IDL> procedure_name, a, b, key1=c
An IDL function is another kind of subroutine and has something like
FUNCTION FUNCTION_NAME, PARAM1, PARAM2
at the top of the file. The primary output is passed to result
but it is possible to have parameters in the call which can receive output.
It is executed with a command like:
IDL> result = function_name(a,b)