delphi if 문장 순환 문장

2913 단어
if  -------------------------------------------------------------------------------------------------------------------------------------------------
  delphi  IF   VB        ,  IF .... THEN...
  DELPHI                BEGIN,END.      JAVA  {} ,  。
     IF     ":
1、IF.. THEN
if 1=1 then
begin
//       
end;

2、IF..ELSE
if 1=1 then
begin
..............
end //         。
else
begin
.....................
end; //       

3、IF...ELSE IF..
if 1=1 then
begin
..............
end //         。
else IF 1=2 THEN
begin
.....................
end; //       

OK,     。
 
 
    -----------------------------------------------------------------------------------------------------------------------------------------
 Delphi     for to/down to do、while…do repeat…until           。
view source
print?
01	var
02	  I: Integer;
03	  X: Integer;
04	begin
05	  X := 10;
06	  for I := 0 to 9 do       { I 0     9,    10 DoSomething}
07	  begin
08	    { DoSomething}
09	  end;
10	  
11	  for I := 0 to Pred(X) do { Pred(X)  X     , 9}
12	  begin
13	    { DoSomething}
14	  end;
15	  
16	  for I := 9  downto 0 do  { I 9     0,    10 DoSomething}
17	  begin
18	    { DoSomething}
19	  end;
20	  
21	  X := 8;                  { I 9   0,  10 }
22	  for I := Succ(X) downto 0 do
23	  begin                    { Succ           }
24	    { DoSomething}
25	  end;
26	  
27	  I := 0;
28	  while I <= 10 do  {  for I := 0 to 10 do       }
29	  begin
30	    ShowMessage(IntToStr(I));
31	    Inc(I);         { while               }
32	  end;
33	  
34	  I := 0;
35	  repeat            {  while I <= 10 do     }
36	    ShowMessage(IntToStr(I));
37	    Inc(I);
	  until I = 10;
	  
	  I := 0;   { Inc       ,Dec       }
	  Inc(I);   { I = 1}
	  Inc(I, 2);{ I = 3}
	  Dec(I, 2);{ I = 1}
	  Dec(I);   { I = 0}
	  ShowMessage(IntToStr(I));
end; Caution for , 1 , 。 while , for 。 repeat while 。while , repeat , 。 Note I FORTRAN , for 。 Continue Break Continue , , Continue 。 try…finally finally..end 。 view source print? var I:Integer; begin for I := 0 to 2 do begin try if I < 1 then Continue; ShowMessage(IntToStr(I)); finally ShowMessage('finally..end'); end; end; end; ( 0,1,2 I ): 0027 Break , 。 try…finally , finally…end , : view source print? var I:Integer; begin for I := 0 to 2 do begin try if I > 1 then Break; ShowMessage(IntToStr(I)); finally ShowMessage('finally..end'); end; end; end; ( 0,1,2 I ): 0028 Continue Break for、while repeat , 。

  
전재 대상:https://www.cnblogs.com/94YY/p/3481370.html

좋은 웹페이지 즐겨찾기