Special Characters
Within the IDL environment, a number of characters have special meanings.
The following table lists characters with special interpretations and states their functions in IDL. These characters are discussed further in the descriptions following the table.
Exclamation Point (!)
The exclamation point is the first character of names of IDL system-defined variables. System variables are predefined scalar variables of a fixed type. Their purpose is to override defaults for system procedures, to return status information, and to control the action of IDL.
Apostrophe (')
The apostrophe delimits string literals and indicates part of an octal or hex constant.
Semicolon (;)
The semicolon is the first character of the optional comment field of an IDL statement. All text on a line following a semicolon is ignored by IDL. A line can consist of a comment only or both a valid statement and a comment.
Dollar Sign ($)
The dollar sign at the end of a line indicates that the current statement is continued on the following line. The dollar sign character can appear anywhere a space is legal except within a string constant or between a function name and the first open parenthesis. Any number of continuation lines are allowed.
When the $ character is entered as the first character after the IDL prompt, the rest of the line is sent to the operating system as a command. If $ is the only character present, an interactive subprocess is started. Under UNIX, IDL execution suspends until the new shell process terminates.
Quotation Mark (")
The quotation mark precedes octal numbers, which are always integers, and delimits string constants. Example: "100B is a byte constant equal to 64 base 10 and "Don't drink the water" is a string constant.
Period (.)
The period or decimal point indicates in a numeric constant that the number is of floating-point or double-precision type. Example: 1.0 is a floating-point number. Also, in response to the IDL prompt, the period begins an executive command. For example,
causes IDL to compile the file myfile.pro. If myfile.pro contains a main program, the program also will be executed. In addition, the period precedes the name of a tag when referring to a field within a structure. For example, a reference to a tag called NAME in a structure stored in the variable A is A.NAME.
Ampersand (&)
The ampersand separates multiple statements on one line. Statements can be combined until the maximum line length is reached. For example, the following line contains two statements:
Colon (:)
The colon ends label identifiers. Labels can only be referenced by GOTO and ON_ERROR statements. The following line contains a statement with the label LOOP1.
The colon also separates the starting and ending subscripts in subscript range specifiers. For example, A(3:6) designates elements three to six of the variable A.
Asterisk (*)
The asterisk represents one of the following, depending on context:
- Multiplication (3 * 3).
- An ending subscript range equal to the size of the dimension. For example,
A[3:*]represents all elements of the vector A from A[3] to the last element, whileB[*,3]represents all elements of row four of matrix B. - A pointer dereference operation. For example, if
ptris a valid pointer (created via the PTR_NEW function), then*ptris the value held by the heap variable thatptrpoints to. For more information on IDL pointers, see Operations on Pointers (Application Programming).
At Sign (@)
The "at" sign is used both as an include character and to signal batch execution.
@ as an Include Character
The "at" sign at the beginning of a line causes the IDL compiler to substitute the contents of the file whose name appears after the @ for the line. If the full path name is not specified after the @ symbol, IDL searches the current directory and the list of directories specified by the system variable !PATH.
For example, the line
when included in a file, causes the file doit.pro to be compiled in its place. (The suffix .pro is the default for IDL program files.) When the end of the file is reached, compilation resumes at the line after the @.
@ to Signal Batch Processing
When IDL is running in interactive mode, a line beginning with the character @ is entered in response to the IDL prompt and the file is opened for batch input. See Executing Batch Jobs in IDL (Application Programming) for details.
Question Mark (?)
The question mark is used as follows:
For more on conditional expressions, see Working with Conditional Expressions (Application Programming).