
Concepts - 9
NOTE: Attempting to enter a line with more than 24 constants will cause the remainder of the line to be
terminated. CAM BASIC does this to prevent serious program malfunction. If you create a program
on a PC and try to download a line with more than 24 constants, CAM BASIC will try to send an
error m essage. Subsequent lines will become garbled as the synchronous nature of data transmission
is lost.
When numeric constants are printed in a program listing, they are always followed by a space. The space is added by the
LIST statement and is not stored in your program.
OPERATORS
Arithmetic Operator s:
CAM BASIC is capable of m anipulating single bits within an 8– bit field, packed BC D data, 8– bit bytes, 16– bit words,
and real (floating point) numbers.
CAM BASIC assum es that all numbers contained in a program and those input by the oper ator are decimal. It can also
accept hexadecimal numbers. The prefix of the number determines its modulus. For example,
Decimal 33797 (no prefix needed)
Hexadecimal &8405 (& means hexadecimal)
Binary @11001001 (@ means binary)
The output can be in decim al, hexadecim al or binar y format:
Decimal 242
Hexadecimal E2
Additional math operators are:
Operator Operation Exam ple
+ addition X+ Y
– subtraction X– Y
* multiplication X*Y
/ division X/Y
\ integer division X\Y
mod modulo X mod Y
Expression analysis of multiplication and division is carried out first from left to right. Then addition and subtraction are
evaluated fr om left to r ight.
NOTE: Values for X and Y cannot exceed 32767 or be less than – 32768 when perform ing integer division.
If these values are exce eded, overflow will occur , data will be erroneou s and no er ror m essage will
be generated.
Relational Operators
Operator Relation Example
Tested
= equal X= Y
<> not equal X<>Y
Komentarze do niniejszej Instrukcji