VBL Operators: Comparison, Logical, and Set Operations
Comparison Operators
Section titled “Comparison Operators”| Operator | Meaning | Example |
|---|---|---|
== |
Equal to | status == 1 |
!= |
Not equal to | risk_level != 0 |
> |
Greater than | balance > 1000 |
< |
Less than | score < 100 |
>= |
Greater than or equal to | age >= 18 |
<= |
Less than or equal to | amount <= 50000 |
Comparison operators work on:
- Integer values: 64-bit signed integer arithmetic
- String values: all six comparison operators (lexicographic ordering)
- Boolean values: equality comparisons (
==,!=) only - Field references: compare two workload fields:
refund_amount <= order_total
Boolean Comparisons
Section titled “Boolean Comparisons”predicate: sanctions_ok: sanctions_cleared == truepredicate: not_break_glass: is_break_glass == falseBoolean literals are lowercase: true and false.
String Comparisons
Section titled “String Comparisons”predicate: read_only: access_level == "read_only"All six comparison operators work on strings using lexicographic ordering.
Field-to-Field Comparisons
Section titled “Field-to-Field Comparisons”predicate: dosage_safe: prescribed_mg <= max_daily_mgpredicate: refund_ok: refund_amount_cents <= order_total_centsBoth sides reference workload fields. The engine compares their values at evaluation time.
Logical Operators
Section titled “Logical Operators”| Operator | Meaning | Precedence |
|---|---|---|
NOT |
Logical negation | Highest |
AND |
Logical conjunction | Middle |
OR |
Logical disjunction | Lowest |
All logical operators are non-short-circuiting: both branches of AND and OR are always evaluated for deterministic instruction counting.
Set Membership
Section titled “Set Membership”Test whether a value belongs to a set:
field IN @set_namefield NOT IN @set_nameNamed sets are defined with define_set and referenced with @:
define_set blocked_jurisdictions: ("NK", "IR", "SY", "CU")
predicate: not_blocked: destination_country NOT IN @blocked_jurisdictionsInline literal sets are also valid:
predicate: severity_actionable: severity IN ("HIGH", "CRITICAL")Containment
Section titled “Containment”Test whether a list-valued field contains a scalar value:
field CONTAINS literalExample:
predicate: has_required_approver: approver_list CONTAINS "compliance_officer"Operator Precedence
Section titled “Operator Precedence”From highest to lowest:
NOT- Comparison operators (
==,!=,>,<,>=,<=),IN,NOT IN,CONTAINS ANDOR
Use parentheses to override precedence when needed.
Next Steps
Section titled “Next Steps”- BOUNDARY Expressions: using operators in expressions
- Integer Semantics: arithmetic behavior
- Language Reference: complete grammar
