Arithmetic
Alongside the standard operators, Vesper includes a few aimed squarely at numerical work:
| Operator | Name | Example | Result |
|---|---|---|---|
| + | Addition | let a=5+2; |
7 |
| - | Subtraction | let b =5-2 |
3 |
| * | Multiplication | let c=5*2 |
10 |
| / | division | let d= 5.2/2 |
2.5 |
| % | Reminder | let e=5%2 |
1 |
| // | Floor division | let f=5//2 |
2 |
| ** | Exponentiation | let g=5\*\*2 |
25 |
let a = 10 % 3;
let b = 10 // 3;
let c = 2 ** 10;
let d = 2 ** -2;
Floor division follows mathematical floor semantics rather than truncation:
-7 // 2 = -4
and the corresponding remainder is:
-7 % 2 = 1
Exponentiation is right-associative, so:
2 ** 3 ** 2
is interpreted as 2 ** (3 ** 2).
Unary operators
Vesper supports unary + and - for numeric values:
let x = -42;
let y = +10;
let z = -3.14;
Unary minus respects mathematical precedence around exponentiation:
-2 ** 2
is interpreted as -(2 ** 2), while:
(-2) ** 2
is 4.
Comparison
| Operator | Name | Example | Result |
|---|---|---|---|
| == | Equal to | 5 == 5 |
true |
| != | Not equal to | 5 != 3 |
true |
| < | Less than | 3 < 5 |
true |
| <= | Less than or equal to | 3 <= 3 |
true |
| > | Greater than | 5 > 3 |
true |
| >= | Greater than or equal to | 5 >= 5 |
true |
Strings & escape sequences
Strings support escape sequences:
let message = "Hello\nWorld";
let path = "C:\\Users\\Vesper";
More escape sequences are being added as the language develops.
print accepts multiple expressions in a single call, evaluating and writing each in sequence:
print("Value: ", 42, "\n");
It does not automatically append a newline — produce one explicitly with \n when you want it:
print("Hello\n");
print("World\n");
Comments
Line comments use #:
# This is a comment
let x = 10; # Inline comment
Block comments are supported by the language tooling using a doubled ##:
##
This is a block comment.
##
# was chosen deliberately so it doesn’t collide with Vesper’s floor-division operator, //.