next up previous 63
Next: Summary of Rules for Command Parameters
Up: Commands
Previous: Commands


Command Format

An ICL command consists of a command name, which is formed using exactly the same rules as we described earlier for variable names, followed by optionally, one or more parameters. Parameters can take three forms: The parameters may be separated by commas, or by one or more spaces.

The first form of the parameter is used when we want to pass the value of an expression to the command, or we want to give the command a variable into which it will return a value. The other two forms both pass a string.

We can illustrate these various cases by using the PRINT command, which prints its parameters on the terminal.

    ICL> X=1.234
    ICL> PRINT (X)
    1.23400
    ICL> PRINT 'HELLO'
    HELLO
    ICL> PRINT HELLO
    HELLO
In most cases therefore we do not need to use the quoted form of string parameters because the simpler form will work. We need the quoted form of strings for those cases in which we need to include a left parenthesis, or spaces in the string. Here is an example with several parameters.
    ICL> X=2
    ICL> PRINT The Square Root of (X) is (SQRT(X))
    The Square Root of          2 is 1.414214
What is happening here is that, since spaces are parameter separators, 'The', 'Square', 'Root' and 'of' are all received by PRINT as independent parameters. However PRINT simply concatenates all its parameters, with a space between each pair, and thus the result is the string just as we typed it. Many other ICL commands which accept strings work in this way. This means that strings with single spaces do not usually need quotes when used as command parameters.

next up previous 63
Next: Summary of Rules for Command Parameters
Up: Commands
Previous: Commands

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