# Expressions

Expression work like school algebra. You can mix numbers and text. Its the operator that decides if a value is considered as number or as text.

Values can be constants (numbers or quoted text) or variables. They must have a valid name

Variables can created by the following:

- Globally, with the set instruction.
- Locally, as a field in a row of a table.
- More locally, as parameter or with set in a program, a function or an aggregator.

You can see always see the more global variable, even superseed it, but not change it from a local context.

### Operators for numbers

operator | example | result |
---|---|---|

+ | 4 + 5 | 9 |

- | 9 - 6 | 3 |

- unary | 5 * -4 | -20 |

* | 4 * 5 | 20 |

/ | 9 / 6 | 1.5 |

div | 9 div 6 | 1 |

mod | 9 mod 6 | 3 |

### Operators for text

operator | code | result |
---|---|---|

. | "Foo"."bar" | Foobar |

### Comparison operators for numbers

operator | code | result |
---|---|---|

= | 5 = 4 | 0 |

!= | 5 != 4 | 1 |

< | 5 < 4 | 0 |

<= | 5 <= 4 | 0 |

>= | 5 >= 4 | 1 |

> | 5 > 4 | 1 |

### Comparison operators for text

operator | code | result |
---|---|---|

== | "foo" == "bar" | 0 |

!== | "foo" != "bar" | 0 |

<< | "foo" << "bar" | 0 |

>> | "foo" >> "bar" | 1 |

regex | "foo" regex "fo+" | 1 |

### Logical operators

operator | code | result |
---|---|---|

and | 0 and 0 | 0 |

and | 1 and 0 | 0 |

and | 1 and 1 | 1 |

or | 0 or 0 | 0 |

or | 1 or 0 | 1 |

or | 1 or 1 | 1 |

xor | 0 xor 0 | 0 |

xor | 1 xor 0 | 1 |

xor | 1 xor 1 | 0 |

not | not 0 | 1 |

not | not 1 | 0 |

See also Boolean logic truth table

### Grouping

operator | code | result |
---|---|---|

() | (4 + 3) * 5 | 35 |

() | 4 + (3 * 5) | 19 |

, | in functions |

If you the operators **and** or **or**, the right argument is not evaluated if the left argument is already determent for the result.

Expressions can include functions.