BBj Object Operators

Description

All of the operators that work with numbers and strings also work with object expressions. Both sides of the operation must evaluate to the same type (string, number or object). For example, this is a runtime error:

>LET A!="123",B!=123                            
>IF A!=B! THEN PRINT "EQUAL"                     
!ERROR=26 (Undefined operation: STRING = NUMBER)

The following table lists the meaning of each operator for number, string and object expressions:

Operator

STRING

NUMBER

OBJECT

+

Concatenation

Addition

Error

=

String comparison

Numeric comparison at the current precision

A!.equals(B!)

<>

String comparison

Numeric comparison at the current precision

!(A!.equals(B!))

<=, >=, >, <

String comparison

Numeric comparison at the current precision

Error

-, *, /, ^

Error

Ok

Error

AND, OR

Error

Ok

Error

Unary !, -, +

Error

Ok

Error

Note #1: An Error indicates an illegal operation.

Note #2: It is legal to compare a string to null().

See Also

BBj Object Variables

BBj Object Assignment

BBj Object Error Handling