ZBasic Language Reference
27
ZX Microcontroller Family
For Single operands, dividing by zero produces a special value indicating either positive or negative
infinity depending on the sign of the dividend. Dividing 0.0 by 0.0 produces a special value called NaN,
representing a value that is Not a Number. Similarly, performing the Mod operation with Single values
using a divisor of zero produces a NaN. For all other operand types the result of using a zero divisor for
either division or Mod is undefined. The System Library function SngClass() returns a value indicating
the general classification of a value of type Single. See the description of SngClass() in the System
Library Reference Manual for more information.
2.4.4 Logical Operators
The logical operators are listed in the table below along with the permitted operand types. The result is
the same type as the operand(s).
Logical Operators
Function
Type
Operator
Permitted Operand Types
Logical AND (conjunction)
Binary
And
Boolean
Bitwise AND
Binary
And
any integral¹
Logical OR (disjunction)
Binary
Or
Boolean
Bitwise OR
Binary
Or
any integral¹
Logical XOR (exclusive disjunction)
Binary
Xor
Boolean
Bitwise XOR
Binary
Xor
any integral¹
Logical Complement
Unary
Not
Boolean
Bitwise Complement
Unary
Not
any integral¹
Notes:
¹ If Option Strict is enabled, signed types are not allowed.
2.4.5 Comparison Operators
The comparison operators are listed in the table below along with the permitted operand types. The
result type is Boolean.
Comparison Operators
Function
Type
Operator
Permitted Operand Types
Equality
Binary
=
any
Inequality
Binary
<>
any
Greater Than
Binary
>
String or any numeric
Greater Than or Equal To
Binary
>=
String or any numeric
Less Than
Binary
<
String or any numeric
Less Than or Equal To
Binary
<=
String or any numeric
2.4.6 Miscellaneous Operators
The remaining operator to be described is the string concatenation operator, &. Both operands must be
type String and the result will be type String. Note that the + operator may also be used for
concatenating strings. The sole difference between using & and using + is that the former supports
automatic value-to-string conversion while the latter does not.
2.4.7 No Short Circuit Evaluation
It is important to note that in ZBasic, as in most Basic dialects, every term in an expression is always
evaluated irrespective of the intermediate results. This is a technical detail that is significant only when
an expression contains function invocations and the act of invoking one or more of the functions involved
has side effects like modifying a global variable, modifying a parameter passed by reference, or