Relation:set
Description
set name = expression
Parameters
- name: any valid name
- expression: any expression
Examples
example | comment |
---|---|
set year = 2018 |
|
set id = id+1 |
adds 1 to the variable id |
set nextyear = year + 1 |
nextyear is 2019 |
Use of first row of current relation
relation a,b
insert 1,3
insert 5,6
set v = b
echo v // 3
Comments
Variables created by set can be used in the instructions like select or extend. The behave like columns, but are not part of the relation.
Variables can also be used in the flow control with if or while.
Variables by set are global in their context and in subroutines that are called from the context.
If there is a relation of the stack, the fields of the first row can be used to calculate the variable.