Skip to main content

2.1) Variable Definitions


It is not necessary to define all variables at the start of a program as you do in some other programming languages. Variables can be created dynamically by assigning them a value at any time. Insert the following lines into a file called variable_test.pro.

a = 1
b = 2
c = a + b
END

Now run the program on the command line. Type "help" at the IDL prompt to check the contents of the variables.

.r variable_test
help

IDL should print the following to the screen, telling you that a, b and c are integers (INT).