Please enable JavaScript to view this site.

A-Shell Reference

Navigation: A-Shell BASIC (ASB) > Operators

Binary Arithmetic and Logical Operators

Scroll Prev Top Next More

These operators are placed between the two operands that they act on (e.g. A + B, Q MAX R, etc.). Note that while some of these are typically thought of and used as logical operators, internally they all act in numeric bitwise fashion, with the logical interpretation based on whether the result is zero or non-zero. This is discussed in more detail in the following two topics.

Operator

Description

+

addition

-

subtraction

*

multiplication

/

division

^

raise first operand to power of second operand

**

same as ^

AND

bitwise AND

OR

bitwise OR

XOR

bitwise XOR

MAX

X MAX Y returns the larger of X and Y, i.e. equivalent to MAX(X,Y) in some other languages.

MIN

X MIN Y returns the smaller of X and Y, i.e. equivalent to MIN(X,Y) in some other languages.

=

Returns TRUE (-1) if the two operands are equal, else FALSE (0); not to be confused with = assignment operator

<>

not equal (reverse of =)

#

not equal (same as <>)

>

returns TRUE (-1) if the first operand is greater than the second

>=

returns TRUE (-1) if the first operand is greater than or equal to the second

<

returns TRUE (-1) if the first operand is less than the second

<=

returns TRUE (-1) if the first operand is less than or equal to the second

MOD

X MOD Y returns the "modulo" of X relative to Y, i.e. the integer remainder after dividing Y into X. For example, a Julian date can be converted to the day of the week using JULDATE MOD 7 (returning a value in the range of 0-6, which you may then want to adjust according to what value you want to assign to what you consider the first day of the week).