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.




First character of system variable names and font-positioning commands


Delimit string constants

Indicate part of octal or hex constant


Begin comment field


Continue current command on the next line

Issue operating system command if entered on a line by itself


Delimit string constants or precede octal constants


Indicate constant is floating point

Start executive command


Separate multiple statements on one line


End label identifiers for goto and structure fields

Separate start and end subscript ranges

Construct arrays of increasing/decreasing values


Multiplication operator

Array subscript range

Pointer dereference (if in front of a valid pointer)


Include file

Execute IDL batch file


Invokes online help when entered at the IDL command line

Part of the ?: ternary operator used in conditional expressions

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,

.run myfile

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:

I = 1 & PRINT, 'value:', I

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.

LOOP1: X = 2.5

The colon also ends identifiers for structure fields:

a = {FIELD1: 5, FIELD2: 10}

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.

Finally, the colon operator can be used to construct arrays of increasing or decreasing values:

print, [0: 1: 0.1]
0.0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0

Asterisk (*)

The asterisk represents one of the following, depending on context:

  1. Multiplication (3 * 3).
  2. 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, while B[*,3] represents all elements of row four of matrix B.
  3. A pointer dereference operation. For example, if ptr is a valid pointer (created via the PTR_NEW function), then *ptr is the value held by the heap variable that ptr points to. For more information on IDL pointers, see Operations on Pointers.

At Sign (@)

The at sign is used both as an include character and to signal batch execution.

At sign 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. See Include Files for details.

At sign 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 Batch Files for details.

Question Mark (?)

The question mark is used as follows:

  • When entered at the IDL command line, the IDL online help facility is invoked.
  • Used in conditional expressions as part of the ?: ternary operator. For example:
; A shorter way of saying IF (a GT b) THEN z=a ELSE z=b:
z = (a GT b) ? a : b