3 boolean expressions – Rockwell Automation 57C610 Enhanced Basic Language, AutoMax User Manual

Page 36

Advertising
background image

5Ć4

The relational operators="and < >" or > <" are used when

there is a relational or comparison expression, such as that found in

an IF"statement. The statement below tests the value of the

boolean which is the result of the string comparison. If the result is

true and the two strings are not equal (< >), the program transfers

control to line 250. The relational operator =" is used in the same

way to test strings:

20 IF C$ < > MESSAGE" THEN GOTO 250

When strings are concatenated (added) and the result is stored in a

string variable (A$ = B$ + TEXT"), the resultant length of the

computed string expression still must not exceed the maximum

length for a string (255 characters if specified in the variable

definition, 31 as a default if no size is specified). If it is longer than

the maximum, it is truncated to the maximum and loaded.
If the string expression is used in a relational expression or PRINT

statement where it is not assigned to a variable but only exists as a

temporary entity, the string expression may be as large as 132

characters.
The following are strings used as intermediate values. In both cases,

the string expression enclosed within the parentheses may be as

large as 132 characters. If it exceeds that length, it is truncated to

132 characters. This means that BASIC will allow string expressions

to be as large as 132 characters while the expression is being

computed; however, at the time it is to be assigned to a string

variable, it must be able to fit the string into the allocated variable

space (31 default, 1Ć255 if specified in the variable definition):

IF (A$ + C$) < > (B$ + TEXT") THEN 200

PRINT (HI"+ A$ + B$ + C$),N%,XYZ

5.3

Boolean Expressions

A boolean expression, just like a boolean variable, evaluates to a

true/false value. Refer to table 5.3 for the truth table. Boolean

expressions use the following boolean operators:
AND

(performs logical AND" function)

OR

(performs logical OR" function)

XOR

(performs logical exclusiveĆOR" function)

NOT

(unary boolean operator performs a boolean

complement)

The following are boolean expressions:

OVER_TEMP@ (Simple boolean variable, TRUE or FALSE)
OVER_TEMP@ AND SHUTDOWN_READY@ (ANDs two

boolean results together)
NOT ((A@OR B@ AND C@) (complex boolean expression)

Advertising
This manual is related to the following products: