Entering Procedure Definitions

Procedures and functions are compiled using the .RUN or .COMPILE executive commands. The format of these commands is as follows:

.RUN [File1 , Filen, ... ] 
.COMPILE [File1 , Filen, ... ] 

From 1 to 10 files, each containing one or more program units, can be compiled. For more information, see .RUN and ".COMPILE" (IDL Reference Guide).

To enter program text directly from the keyboard, simply enter .RUN at the IDL> prompt. IDL will prompt with the "-" character, indicating that it is compiling a directly entered program. As long as IDL requires more text to complete a program unit, it prompts with the "-"character. Rather than executing statements immediately after they are entered, IDL compiles the program unit as a whole. See Creating $MAIN$ Programs for more information.

Procedure and function definition statements cannot be entered in the single-statement mode, but must be prefaced by either .RUN or .RNEW.

The first non-empty line the IDL compiler reads determines the type of the program unit: procedure, function, or main program. If the first non-empty line is not a procedure or function definition statement, the program unit is assumed to be a main program. The name of the procedure or function is given by the identifier following the keyword PRO or FUNCTION. If a program unit with the same name is already compiled, it is replaced by the new program unit.