Transactions - Syntax and Operators

Prev Next

Syntax and Operator Usage

Left-hand destination Transaction Prefix
(optional)
Transaction Operator Transaction Suffix
(optional)
Right-hand destination
- Variable No symbol: Replacement <== : Copy No symbol - Variable
- Table row & : intersection (AND combination) <<= : Move ^ : Members only - Table row
| : union (OR combination) <=> : Swap (Base variable will not
+ : add data be touched)


The 3-character Transaction Operators must be written together without spaces inbetween because they are treated as dedicated language tokens. Spaces are allowed between the prefix and the symbols and between the symbols and the suffix. Both left-hand and right-hand destinations specify table cells or destination variables in the same way as if they would be on the left-hand side of assignments. Specifying member variables in (nested) arrays and/or structures is allowed (Example: b[kid1] <== a[kid2,grandchild]). Using this in combination with moving or swapping data, you can do easy data manipulations such as balancing binary trees.

First Example:
       array( a[], { Ape, Bat, Cat, Dog } );
       array( b[], { Granite, Gneiss } );

       a[] = Animals;
       b[] = Varieties of Rocks;
       c[] = Pets;

       c[] <==^ a[]; // Base variable stays unchanged (Pets)

       a[] <=> b[]; // Swap

       see( c[] ); // Pets
       see( a[] ); // Rocks
       see( b[] ); // Animals
c[]                     Pets                       (softquoted string,full access)
Array [   0]            Ape                        (softquoted string,full access)
Array [   1]            Bat                        (softquoted string,full access)
Array [   2]            Cat                        (softquoted string,full access)
Array [   3]            Dog                        (softquoted string,full access)

a[]                     Varieties of Rocks         (softquoted string,full access)
Array [   0]            Granite                    (softquoted string,full access)
Array [   1]            Gneiss                     (softquoted string,full access)

b[]                     Animals                    (softquoted string,full access)
Array [   0]            Ape                        (softquoted string,full access)
Array [   1]            Bat                        (softquoted string,full access)
Array [   2]            Cat                        (softquoted string,full access)
Array [   3]            Dog                        (softquoted string,full access)

Try it yourself: Open LAN_Features_Transaction_Syntax.b4p in B4P_Examples.zip. Decompress before use.