Instructions

181 C-Control Pro IDE
© 2013 Conrad Electronic
&&
logical And
1 && 1
5 && 0
1
0
||
logical Or
0 || 0
1 || 0
0
1
!
logical Not
!2
!0
0
1
4.2.6 Control Structures
Control structures allow to change the program completion depending on expressions, variables or
external influences.
4.2.6.1 Conditional Valuation
With a conditional valuation expressions can be generated which will be conditionally calculated.
The form is:
( Expression1 ) ? Expression2 : Expression3
The result of this expression is expression2, if expression1 had been calculated as unequal 0, other-
wise the result is expression 3.
Examples:
a = (i>5) ? i : 0;
a= (i>b*2) ? i-5 : b+1;
while(i> ((x>y) ? x : y) ) i++;
4.2.6.2 do .. while
With a do .. while construct the instructions can depending on a condition be repeated in a loop:
do Instruction while( Expression );
The instruction or the Instruction Block is being executed. At the end the Expression is evaluated. If
the result is unequal 0 then the execution of the expression will be repeated. The entire procedure
will constantly be repeated until the Expression takes on the value 0.
Example:
do
a=a+2;
while(a<10);
do