$ Format Code

Available Format Codes

When IDL completes output format processing, it normally outputs a newline to terminate the output operation. However, if a "$" format code is found in the format specification, this default newline is not output. The "$" format code is only used on output; it is ignored during input formatting.

The syntax is:

$ 

One use for the "$" format code is in prompting for user input in programs that run in a tty rather than in the graphical IDL Workbench. For example, the following simple program show the difference between strings formatted with and without the "$" format code. The first PRINT statement prompts the user for input without forcing the user's response to appear on a separate line from the prompt; the second PRINT statement makes the user enter the response on a separate line.

IDL> .run 
- PRO format_test 
- name='' 
- age=0 
- PRINT, FORMAT='($, "Enter name")' 
- READ, name 
- PRINT, FORMAT='("Enter age")' 
- READ, age 
- PRINT, FORMAT='("You are ", I0, " years old, ", A0)', age, name 
- END 
% Compiled module: FORMAT_TEST. 

Running the procedure looks like this:

IDL> format_test 
Enter name: Pat 
Enter age 
: 29 
You are 29 years old, Pat 
IDL>  

where the values in italics were entered by the user in response to the prompts.