User manual

mikroBasic PRO for PIC32
MikroElektronika
223
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 specic 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 dene algorithmic actions within a program. Each statement needs to be terminated with a semicolon
(;). In the absence of specic 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
Assignment Statements
Assignment statements have the following form:
variable = expression
The statement evaluates expression and assigns its value to variable. All the rules of implicit conversion are
applied. Variable can be any declared variable or array element, and expression can be any expression.
Do not confuse the assignment with relational operator = which tests for equality. mikroBasic PRO for PIC32 will
interpret the meaning of the character = from the context.