Download xBasic 1.0 - Parallax Forums
Transcript
3.1 Expressions
An expression is either a constant, a variable, or some combination of
one or more of those using various operators. There are so many that it
is helpful to consider them in groups or categories:
•
Constant Expressions
decimal-constant
•
-
/
MOD -
OR
AND
=
<>
<
<=
>=
>
Bitwise Expressions
~
•
*
Logical Expressions
NOT
•
string-constant
Arithmetic Expressions
+
•
0xhex-constant
&
|
^
<<
>>
Other Expressions
(...)
variable
array-reference
function-call
Below are descriptions of each of them, by category. We examine
constant expressions first, because we will see them in examples of all
the other expressions.
3.1.1 Constant Expressions
decimal-constant
hexadecimal-constant
string-constant
3.1.1.1 decimal constant
The value of this expression is a specific integer value
represented as a signed decimal number.
Syntax:
[ { + | - } ] decimal-digit-string
where decimal-digit-string is from 1 to 5 decimal digits with no
intervening characters of any kind. The lower bound is -32768,
and the upper bound is 32767.
A “minus” (negative-value) symbol may precede the decimaldigit-string, and space is allowed between the sign and the
decimal-digit-string.
Examples:
This expression: has this value:
xBasic User Manual Page 8