next up previous 63
Next: Variables in Procedures
Up: ICL Procedures
Previous: The LOOP Structure


Prompting for Procedure Parameters

Normally a procedure will not be obeyed unless the required number of parameters is provided - the TOOFEWPARS exception is signalled. However, this check can be switched off using the NOCHECKPARS command. Then the procedure will be executed with the parameter being undefined. This fact can be used to write a procedure which will prompt for an undefined parameter, e.g.:
PROC SQUARE_ROOT X
{ An ICL procedure to print the square root of a number,   }
{ prompting if the number is not given on the command line }
  IF UNDEFINED(X)
    INPUT 'Give the value of X: ' (X)
  ENDIF
  PRINT The Square Root of (X) is (SQRT(X))
END PROC
Note that only trailing parameters may be omitted

next up previous 63
Next: Variables in Procedures
Up: ICL Procedures
Previous: The LOOP Structure

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