next up previous 63
Next: Functions
Up: Expressions
Previous: Variables


Operators

The operators which are used to build up expressions are listed in the following table.
Priority

   1 (highest)              **
   2                        *   /
   3                        +   -
   4                        =   >   <   >=  <=  <>  :
   5 (lowest)               NOT   AND   OR   &
The order of evaluation of expressions is determined by the priority of the operators. The rules are the same as those in FORTRAN2.2 with arithmetic operators having the highest priority, and logical operators the lowest. This means that a condition such as \( 0 < X+Y \leq 1 \) can be expressed in ICL as follows
    X+Y > 0  AND  X+Y <= 1
without requiring any parentheses. In general however, it is good practice to use parentheses to clarify any situation in which the order of evaluation is in doubt.

In evaluating expressions ICL will freely apply type conversion to its operands in order to make sense of them. This means not only that integers will be converted to reals when required, but also that strings will be converted to numbers when possible. A string can be converted to a numeric value if the value of the string is itself a valid ICL expression. For example the string '1.2345' has a numeric value. The string 'X+1' has a numeric value if X is currently a numeric variable (or if X is a string which has a numeric value).

The operator & performs string concatenation - operands with numeric values will be converted to strings. The : operator is used for formatting numbers into character strings as described below.


next up previous 63
Next: Functions
Up: Expressions
Previous: Variables

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