next up previous 63
Next: Operators
Up: Expressions
Previous: Constants


Variables

Variables in ICL are represented by names composed of characters which may be letters, digits or the underscore character ( _ ). The first character must be a letter. The first 15 characters of a variable name are significant (i.e. two variable names which are the same in the first 15 characters, but differ in subsequent characters refer to the same variable).

An important difference between ICL and FORTRAN is in the handling of variable types. In FORTRAN each variable name has a unique type associated with it, which is either derived implicitly from the first letter of the name, or is explicitly specified in a declaration.

In ICL names do not have types, only values have types. A variables gains a type when it is assigned a value. This type can change when a new value is assigned to it. Thus we can have the following sequence of assignments making the variable X an integer, real, logical and string in sequence.

    ICL> X = 123
    ICL> X = 123.456
    ICL> X = TRUE
    ICL> X = 'String'
This approach to variable types means we do not have to declare the variables we use which helps to keep programs simple.2.1

next up previous 63
Next: Operators
Up: Expressions
Previous: Constants

ICL The Interactive Command Language for ADAM
Starlink Guide 5
J A Bailey
A J Chipperfield

9th June 1998
E-mail:starlink@jiscmail.ac.uk

Copyright © 2013 Science and Technology Facilities Council