Previous Application Programming: Creating and Running Programs in IDL Next

Making Code Readable

Commenting code and limiting line length both promote readability. See the following sections for details.

Using Code Comments

In IDL, the semicolon (;) is the comment character. When IDL encounters the semicolon, it ignores the remainder of the line. It is good programming practice to fully annotate programs with comments. There are no execution-time or space penalties for comments in IDL.

A comment can exist on a line by itself, or can follow another IDL statement, as shown below:

; This is a comment  
COUNT = 5    ; Set the variable COUNT equal to 5.  


Note
You can also comment or uncomment blocks of code in the IDL Editor window. See Commenting Blocks of Code for details.

Using Line Continuations

The line continuation character ($) allows you to break a single IDL statement into multiple lines. 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.

  IDL Online Help (March 06, 2007)