Skip to content

Arithmetic Operators

Humbat edited this page Sep 9, 2026 · 1 revision

Arithmetic & Increment Operators

Tera supports standard mathematical calculations as well as prefix increment and decrement operations for numeric types.


1. Basic Arithmetic

You can perform mathematical operations and output the results directly using the built-in print statement:

print(6 / 3);  // Division
print(6 * 4);  // Multiplication
print(6 ** 4); // Exponentiation
print(6 % 4);  // Modulo (Remainder)
print(6 - 4);  // Subtraction
print(6 + 4);  // Addition

2. Increment & Decrement Operators

Tera supports prefix increment (++) and decrement (--) operators to modify variable values inline:

let x: 5 => int;

print(++x); // Increments x before printing
print(--x); // Decrements x before printing

Clone this wiki locally