Left-Hand Side Expressions

Prev Next

Overview

The LHS Expressions are expressions on the Left-Hand Side of the assignment symbol or assignment operator, as well as on both sides of the transaction operator in transactions which are used to specify a destination in a variable or table.

LHS Expressions are applicable in following cases:

The following are not allowed in RHS expressions:

Examples

       echo(LHS Examples with variables);
       a[]        = 10;
       a[name]    = 'My Name';    // Structure member 'name' added to a[]
       a[name,0]  = First Name;   // Array added to a[name]
       a[name,1]  = Middle Initial;
       a[name,2]  = Last Name;
       see(a[]);

       echo(RHS Examples with a table);
       table create( List );
       [ List: ..,    0 ]   = { Name, Score }; // Write two values into row 0
       [ List: Name,  1 ]   = Amy;
       [ List: Score, 1 ]   = 10;
       [ List: Name,  2..]  = { Bea,  Claus }; // Write two values into column 0, beginning on row 2
       [ List: Score, 2  ]  = 20;
       [ List: Score, -1 ]  = 30;              // Negative indexing: -1 refers to last entry
       table list( List );
LHS Examples with variables
a[]                     10  "10"                   (numeral,full access)
name                    My Name                    (softquoted string,full access)
  Array [   0]          First Name                 (softquoted string,full access)
  Array [   1]          Middle Initial             (softquoted string,full access)
  Array [   2]          Last Name                  (softquoted string,full access)

RHS Examples with a table
    0 : Name  | Score
    1 : Amy   | 10   
    2 : Bea   | 20   
    3 : Claus | 30   

Try it yourself: Open LAN_Features_Left-Hand_Side_Expression.b4p in B4P_Examples.zip. Decompress before use.

See also

Right-Hand Side Expressions
Expressions