= semantics

This commit is contained in:
Zef Hemel
2023-10-04 09:43:15 +02:00
parent 6dc62f8d14
commit 4904644464
2 changed files with 18 additions and 13 deletions
+12 -9
View File
@@ -83,15 +83,18 @@ Logical expressions:
* or: `name = "this" or age > 10`
Binary expressions:
- `=` equals, e.g. `name = "Pete"`
- `!=` not equals, e.g. `name != "Pete"`
- `<` less than, e.g. `age < 10`
- `<=` less than or equals, e.g. `age <= 10`
- `>` greater than, e.g. `age > 10`
- `>=` greater than or equals, e.g. `age >= 10`
- `=~` to match against a regular expression, e.g. `name =~ /^template\//`
- `!=~` to not match a regular expression, e.g. `name !=~ /^template\//`
- `in` member of a list (e.g. `prop in ["foo", "bar"]`)
* `=` equals.
* For scalar values this performance an equivalence tests (e.g. `10 = 10`)
* If the left operand is an array and the right operand is _not_, this will will check if the right operand is _included_ in the left operands value, e.g. `[1, 2, 3] = 2` will be true.
* If both operands are arrays, they will be compared for equivalence ignoring order, so this will be true: `[1, 2, 3] = [3, 2, 1]`
* `!=` the exact inverse of the meaning of `=`, e.g. `name != "Pete"`
* `<` less than, e.g. `age < 10`
* `<=` less than or equals, e.g. `age <= 10`
* `>` greater than, e.g. `age > 10`
* `>=` greater than or equals, e.g. `age >= 10`
* `=~` to match against a regular expression, e.g. `name =~ /^template\//`
* `!=~` to not match a regular expression, e.g. `name !=~ /^template\//`
* `in` member of a list (e.g. `prop in ["foo", "bar"]`)
* `+` addition (can also concatenate strings), e.g. `10 + 12` or `name + "!!!"`
* `-` subtraction, e.g. `10 - 12`
* `/` addition, e.g. `10 / 12`