User`s manual
mikroBASIC
- Basic Compiler for Microchip PIC microcontrollers
MikroElektronika:
Development
tools
-
Books
-
Compilers
mikroBASIC
making it simple...
69
page
To create legal expressions, you can:
1. combine byte and word with any operators,
2. combine short, integer, and longint (note that longint does not employ *,
div, mod) with any operators,
3. use Relation operators
expression1 (relation operator) expression2
Expression1 and expression2 can be any legal expressions. Be sure to understand
how implicit conversion works with relation operators.
Comparing variable or constant to variable or constant always produces correct
results.
Comparing expressions requires a little more attention.
expression1 (relation operator) expression2
Expressions can be any legal expressions created with arithmetical or logical oper-
ators. Every expression no matter how complex, can be decomposed to a number
of simple expressions. Simple expression is expression composed of just one oper-
ator and its operands. Operator is logical or arithmetical. Examine the rules pre-
sented below.
1. Complex expression is decomposed to a number of simple expressions, with
respect to operator precedence and overriding parenthesis.
2. Simple expression is now treated in the following manner: if operands are of the
same type, operation is performed, assuming that the result is of the same type.
3. If operands are not of the same type, then less complex operand (speaking
in terms of data range) is extended:
IMPLICIT CONVERSION AND LEGAL EXPRESSIONS
Overview
Implicit
Conversion
and Relation
Operators
Rules for
Comparing
Expressions