Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Operators

Alpha-7 supports arithmetic, comparison, bitwise, unary, and loop increment operators.

Arithmetic

OperatorOperation
+Addition
-Subtraction
*Multiplication
/Division
%Modulo
**Power

Example:

Int A = 10;
Int B = 5;

Int C = A + B;
Int D = A - B;
Int E = A * B;
Int F = A / B;
Int G = A % B;

% requires integer operands and returns the integer remainder.

Power

The ** operator performs exponentiation.

Int Result = 2 ** 8;

Power expressions are right-associative.

For example:

A ** B ** C

is interpreted as:

A ** (B ** C)

The current implementation lowers power operations through the C pow function.

Increment and Decrement

++ and -- are postfix operators currently used in the increment section of a For loop.

Example:

For (Int I = 0; I < 10; I++)
{
    Print(\V"{I}");
}

Decrementing is also supported:

For (Int I = 10; I > 0; I--)
{
    Print(\V"{I}");
}

See Unary Operators, Comparisons, and Logical Operators for the related operator families.


← Previous Next →