Mikroelektronika MIKROE-442 Datenbogen
mikroBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
225
Conditional expressions
Conditional expressions may differ from the same code in assignment expressions (due to left side exception).
Example:
a as longword
b as byte
if b*5 then... ‘ byte level - general rule will not give same result as
a = b * 5 ‘ word level - general rule + left side exception
if a then...
if b*5 exceeds byte range.
Explicit Typecasting
Any expression can be evaluated at specific level by using explicit typecasting. Having in mind previous example, in
order to get same calculation in conditional and assignment expression, the following should be done:
if word(b*5) then... ‘ word level
Statements
Statements define algorithmic actions within a program. Each statement needs to be terminated with a semicolon
(;). In the absence of specific jump and selection statements, statements are executed sequentially in the order of
appearance in the source code.
The most simple statements are assignments, procedure calls and jump statements. These can be combined to form
loops, branches and other structured statements.
Refer to:
- Assignment Statements
- Conditional Statements
- Iteration Statements (Loops)
- Jump Statements
- asm Statement