17.07.2013 Views

GWBASIC User's Manual

GWBASIC User's Manual

GWBASIC User's Manual

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

GW-BASIC <strong>User's</strong> Guide<br />

>= Greater than or equal toX>=Y<br />

The equal sign is also used to assign a value to a variable. See the LET statement in the GW-<br />

BASIC <strong>User's</strong> Reference.<br />

When arithmetic and relational operators are combined in one expression, the arithmetic is<br />

always performed first:<br />

X+Y < (T-1)/Z<br />

This expression is true if the value of X plus Y is lessthan the value of T-1 divided by Z.<br />

6.4.3 Logical Operators<br />

Logical operators perform tests on multiple relations, bit manipulation, or Boolean operations.<br />

The logical operator returns a bit-wise result which is either true (not zero) or false (zero). In an<br />

expression, logical operations are performed after arithmetic and relational operations. The<br />

outcome of a logical operation is determined as shown in the following table. The operators are<br />

listed in order of precedence.<br />

Table 6.2<br />

Results Returned by Logical Operations<br />

Operation Value Value Result<br />

NOT X NOT X<br />

T F<br />

F T<br />

AND<br />

X Y<br />

X AND<br />

Y<br />

T T T<br />

T F F<br />

F T F<br />

F F F<br />

OR X Y X OR Y<br />

T T T<br />

T F T<br />

F T T<br />

XOR<br />

F F F<br />

X Y<br />

X XOR<br />

Y<br />

T T F<br />

T F T<br />

F T T<br />

F F F<br />

file:///C|/Documents%20and%20Settings/Lorenzo/Desktop/GW%20Basic/Chapter 6.html (9 of 12)28/03/2004 21.29.00

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!