|
Application Programming: Creating and Running Programs in IDL |
|
In this section, we'll create a simple "Hello World" program consisting of two .pro files. Start the IDLDE and complete the following steps:
New or clicking the New File button on the toolbar.
PRO hello_main name = '' READ, name, PROMPT='Enter Name: ' str = HELLO_WHO(name) PRINT, str END
Save or click Save button on the toolbar. Save the file with the name hello_main.pro in the main IDL directory (which the Save As dialog should already show).
New, and enter the following code:FUNCTION hello_who, who RETURN, 'Hello ' + who END
hello_who.pro in the main IDL directory. This simple program, consisting of a user-defined procedure, calls a user-defined function.
hello_main.pro and hello_who.pro programs by selecting Run
Compile All.
| Note You can also type .COMPILE hello_who.pro, hello_main.pro at the IDL command prompt to compile the files. With functions, the compilation order does matter. See Compiling Your Program for details. |
Run hello_main.
hello_who. The "Hello name" string is returned to the procedure and printed in the Output window. IDL Online Help (March 06, 2007)