.
. , , "", , .
Boolean : False () True (). , "" "+" (), "" "-" ().
:
Var
a: boolean;
d34, Done: boolean;
( ) :
a:=true;
Done:=false;
, .
.
- , .
, - . not () and (), or (), xor ( ).
NOT
(). ( ) .
AND
( ). , ( ) . .
OR
( ). , - () . .
XOR
( ). , () . .
. X Y - (), .
NOT AND, OR, XOR
X | Not X | |
False | True | |
True | False |
X | Y | X and Y | X or Y | X xor Y |
False | False | False | False | False |
False | True | False | True | True |
True | False | False | True | True |
True | True | True | True | False |
:
a:=false; d34:=true;
Done:=not a; {done = true}
|
|
done:=a and d34; {done = false}
done:=a or d34; {done = true}
done:=a xor d34; {done = true}
, .
.
. (Boolean) .
= ; <= ;
<> ; >= ;
< ; > .
:
done:=(5<0); {done = false}
done:=(c<=2); {done = true <=2}
done:=(c<=10) and (c>=0); {done = true 0>=c>=10}
ODD(x)
x. true, x false .
.
.
() :
FALSE < TRUE
( ) . ( ) .
- :
1.
2. {sin(x), cos(x), sqrt(x) ..}
3. { not }
4. { *, /, div, mod, and }
5. { +, -, or, xor }
6. { =, <>, <, >, <=, >=}
.
1. , , x,y r. a,b.
3. q :
) q:=a<b<c and c<5
b) q:=(a<=b) or (b>=c)
c) q:=odd(a+b) xor odd(b+c)
d) q:=sin(a) < sin(b) < sin(c)
a, b, c - , .
4. , , , . .
5. , , , - . .
6. , , , , , - .
7. , , , . .
8. , , , .
9. , , , , .
10. , , a b, , .
|
|