Mikroelektronika MIKROE-742 데이터 시트
Assignment Statements
Assignment statements have the 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. Also
note that, although similar, the construction is not related to the declaration of constants.
note that, although similar, the construction is not related to the declaration of constants.
Compound Statements (Blocks)
Compound statement, or block, is a list of statements enclosed by keywords begin
and end:
and end:
begin
statements
end;
Syntactically, a block is considered to be a single statement which is allowed to be
used when Pascal syntax requires a single statement. Blocks can be nested up to
the limits of memory.
used when Pascal syntax requires a single statement. Blocks can be nested up to
the limits of memory.
For example, the
while
loop expects one statement in its body, so we can pass it a
compound statement:
while i < n do
begin
temp := a[i];
a[i] := b[i];
b[i] := temp;
i := i + 1;
b[i] := temp;
i := i + 1;
end;
Conditional Statements
Conditional or selection statements select one of alternative courses of action by
testing certain values. There are two types of selection statements:
testing certain values. There are two types of selection statements:
- if
- case
- case
163
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Language Reference
mikroPASCAL PRO for AVR
CHAPTER 5