.


:




:

































 

 

 

 


. , ( ).




, ( ).

if

if, , () . :

if S then A else B;

if S then A;

S , ;

A ( )) , , S ;

B ( )) , , S .

if () . , . . , (True), A, then (), (False), B, else ().

- True, A, False - , , if, , .

if .

:

, :

if S1 then if S2 then A else B;

, if else B, , else () if, else, .

.

 

case

. , (selection - ), , ( ). :

Case S of

C1: instruction1;

C2: instruction2;

CN: instructionN

else default_instruction_list;

end;

S , ‑ ;

C1, C2, CN , , S, , ();

instruction1, instruction2, , instructionN ( ) , , S;

default_instruction_list , ;( ), , S C1, C2, CN.

:

1) S C1, C2, CN , real.

2) C1, C2, CN , , label goto.

3) , ; , .

4) else default_instruction_list; .

case.

:

Case I of

1..10: Writeln (' ', I:4, ' 1 - 10');

11..20: Writeln (' ', I:4, ' 11 - 20');

21..30: Writeln (' ', I:4, ' 21 - 30')

else Writeln (' ', I:4, ' ')

end;

:

Case I of

1: Z:= I + 10;

2: Z:= I + 100;

3: Z:= I + 1000

end;

:

Var Season: (Winter, Spring, Summer, Autumn);

begin

Case Season of

Winter: Writeln ('Winter');

Spring: Writeln ('Spring');

Summer: Writeln ('Summer');

Autumn: Writeln ('Autumn')

end;

end;

1

,
(x, y) , . , .

2

,
(x, y) , . .





:


: 2016-11-18; !; : 795 |


:

:

, .
==> ...

1735 - | 1525 -


© 2015-2024 lektsii.org - -

: 0.012 .