Next: LET Free_Syntax
Up: SIC Language Internal Help
Previous: IMPORT
Contents
Index
LET
[SIC\]LET Variable [=] [Expression]
[SIC\]LET Variable [=] Expression /CHOICE Value_1 ... Value_n
[SIC\]LET Variable [=] Expression /FILE Filter
[SIC\]LET Variable [=] Expression /FORMAT format_string
[SIC\]LET Variable [=] Expression /FORMULA
[SIC\]LET Variable [=] Expression /INDEX Value_1 ... Value_n
[SIC\]LET Variable [=] Expression /LOWER
[SIC\]LET Variable [=] Expression /NEW Type [Attr]
[SIC\]LET Variable [=] Expression /PROMPT "Explanatory text"
[SIC\]LET Variable [=] Expression /RANGE Min Max
[SIC\]LET Variable [=] OldVariable /REPLACE
[SIC\]LET Variable [=] Value_1 ... Value_n /RESIZE
[SIC\]LET Variable [=] Expression /SEXAGESIMAL
[SIC\]LET Variable [=] Val1 ... ValN /RESIZE
[SIC\]LET Variable /STATUS Read|Write
[SIC\]LET Variable [=] Expression /UPPER
[SIC\]LET Variable [=] Expression /WHERE Condition_mask
Assign a value to a variable. The variable must already be defined (see
HELP DEFINE) unless the /NEW option is present. Logical expression re-
sults cannot be assigned to non logical variables, and vice versa. All
numerical expression evaluations are done in double precision, and auto-
matically converted to the type of (numerical) variable assigned.
The equal sign may be always omitted EXCEPT when using Free Syntax (see
HELP LET Free_Syntax).
If no value is assigned to the Variable, the user will be prompted for
the variable value. The Prompt text can be defined with the /PROMPT Op-
tion.
VECTOR OPERATION:
Operations are vectorial, i.e. a full array is computed at the same
time. The variable name can define a subset of an known array, such as:
DEFINE REAL A[4,5,6] B[4]
LET A[,,3] = 1.0 ! or equivalently LET A[3] = 1.0
LET A[,2,2] = B ! or equivalently LET A[2,2] = B
These commands assign the value 1.0 to A[i,j,3], with i running from 1
to 4 and j from 1 to 5, and B[k] to A[k,2,2] for k from 1 to 4. Implic-
it transposition is now allowed, though still somewhat experimental:
both A[,2,3] and A[2,,3] are valid. A range of indexes can be specified
rather than one index: for the above example A[3:5] is a valid 4x5x3 ar-
ray, A[2:4,,] is a 3x5x6 array.
IMPLICIT LOOPS:
In addition to vector computing, it is possible to assign an array using
"implicit loops", i.e. functions of the array indices such as
DEFINE REAL A[4,5]
LET A[I,J] = (I-J)**2
Implicit loops cannot be mixed with variable index values.
CONDITION MASK (/WHERE option):
Vector assignment can be done only where a specified logical array (or
logical array expression) is true, using the /WHERE option. See HELP LET
/WHERE.
Subsections
Gildas manager
2024-04-19