vv supports standard arithmetic operations on numbers:
| Operator | Description |
|---|---|
+ |
Addition |
- |
Subtraction |
* |
Multiplication |
/ |
Division |
/: |
Integer Division |
% |
Modulo |
Comparison operations evaluate to a boolean value (true or false):
| Operator | Description |
|---|---|
== |
Equal |
< |
Less Than |
<= |
Less Than or Equal |
Logical operators work on boolean values.
| Operator | Description |
|---|---|
not() |
Logical NOT (Function) |
and |
Logical AND (Reserved) |
or |
Logical OR (Reserved) |
Used to assign or update values of variables:
| Operator | Description |
|---|---|
= |
Assignment |
+= |
Add and Assign |
-= |
Subtract and Assign |
| Operator | Description |
|---|---|
- |
Negation - Inverts the sign of a number |
try |
Try - Unwraps ok
result or
propagates error
|
Expressions can be combined using prefix (e.g., not(true), -5, try result)
and infix (e.g., 1 + 2, a == b) operators.
Instead of traditional built-in functions, vv includes specific syntactic elements parsed directly
as expressions. These look like functions but are built closely into the AST. Key elements include:
len(expr): Retrieves the length of a list or string representation.not(expr): Logical NOT operation on a boolean.