next up previous contents index
Next: Functions and Operators Up: Variables and Expressions Previous: Variables and Expressions   Contents   Index

Definitions and Assignments

SIC supports variables and arithmetic or logical expressions evaluation. Variables can be defined either by the program or by the user. Program-defined variables may have the Read-Only attribute which prevents them from being overwritten by the user (see SIC PROGRAMMING MANUAL). Variable names are up to 15 characters long, upper case only, and must begin with a letter. A variable can be LOCAL or GLOBAL. GLOBAL variables are valid at any execution level in SIC. On the opposite, LOCAL variables are valid only in the procedure where they have been declared, or in any loop started within this procedure, or in any interactive level generated from this procedure (by a PAUSE or an error). Variables declared by a program are always GLOBAL.

Arithmetic and logical expressions are automatically evaluated when used as arguments to commands. The evaluation is done in single or double precision arithmetic, according to command SIC PRECISION. Parentheses are allowed, but there is a limit on the complexity of arithmetic and logical expressions. A local variable has precedence over a global variable of the same name. Local variables are deleted when the creating procedure terminates.

Variables may be defined using command DEFINE, and assigned values using command LET. SIC is a declarative language in which all variables must be defined before being used. For convenience, command LET has an option /NEW which allows declaration of the assigned variable. Five type of variables are allowed : REAL, INTEGER, LOGICAL, DOUBLE (for double precision real variables), and CHARACTER.

Variable values may be typed using the EXAMINE command, which also indicates whether the variable is GLOBAL or LOCAL, and in the latter case, the corresponding procedure level.


next up previous contents index
Next: Functions and Operators Up: Variables and Expressions Previous: Variables and Expressions   Contents   Index
Gildas manager 2014-07-01