next up previous contents index
Next: LET /CHOICE Up: SIC Language Internal Help Previous: IMPORT   Contents   Index


LET

        [SIC\]LET Variable [=] [Expression]
        [SIC\]LET Variable [=] Expression /NEW Type [Attr]
        [SIC\]LET Variable [=] Expression /WHERE Condition_mask
        [SIC\]LET Variable [=] Expression /PROMPT "Explanatory text"
        [SIC\]LET Variable [=] Expression /RANGE Min Max
        [SIC\]LET Variable [=] Expression /CHOICE Value_1 ... Value_n
        [SIC\]LET Variable [=] Expression /INDEX Value_1 ... Value_n
        [SIC\]LET Variable [=] Expression /FILE Filter
        [SIC\]LET Variable [=] Expression /SEXAGESIMAL
        [SIC\]LET Variable [=] Expression /LOWER
        [SIC\]LET Variable [=] Expression /UPPER
        [SIC\]LET Variable [=] Expression /FORMAT format_string
        [SIC\]LET Variable [=] Expression /FORMULA
        [SIC\]LET Variable [=] OldVariable /REPLACE
        [SIC\]LET Variable /STATUS Read|Write

    Assign a value to a variable. The variable must already be defined  (see
    DEFINE)  unless  the  /NEW option is present. Logical expression results
    cannot be assigned to non logical variables, and vice versa. All numeri-
    cal  expression  evaluations are done in double precision, and automati-
    cally converted to the type of (numerical) variable assigned.

    The equal sign may be always omitted EXCEPT when using Free Syntax  (see
    below).

    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.

    FREE SYNTAX:

    The LET command may be omitted if no option is present, and is  the  SIC
    syntax is set to FREE. In case of conflict between a variable name and a
    (complete) command name, an error message is issued. See SIC command.

    GUI (Graphic-User-Interface) input mode:

    If command GUI\PANEL has been issued before,  the  LET  command  defines
    widgets  in the master window defined by GUI\PANEL. The widget is a sim-
    ple prompt when option /PROMPT is set, a  slider  if  option  /RANGE  is
    present,  a  list of choices if option /CHOICE or /INDEX is given, and a
    selection of files with the specified filter when option /FILE is speci-
    fied.  If  neither of these options is present, the LET command works in
    the usual way.

    The widgets are created and activated by command GUI\GO. Standard  input
    can  be  used,  and  pressing button GO will define all the variables as
    specified. If button ABORT is pressed instead, none of the variables are
    modified and an error is returned. Error handling is available.


Subsections

Gildas manager 2015-03-19