Delphi 키워드 상세 정보(만약의 경우로)

240153 단어 Delphipascal
absolute
//             ,                   .
var
  Str: string[32];
  StrLen: Byte absolute Str;

//         StrLen     Str  .
//       0            ,   StrLen        .
begin
  Str := 'abc';
  Edit1.Text := IntToStr(StrLen);
end;

abstract
//           ,               .
//Abstract      Virtual Dynamic       ,               .
//        ,            .
type
  TDemo = class
    private
    protected
      procedure X; virtual; abstract;
    public
      constructor Create;
      destructor Destroy; override;
    published
  end;

and
// 、     
if (a>0) and (b>0) then

// 、     
var
  a,b,c: Integer;
begin
  c := (a and b);
end;

//  And     , And              ,           .
//  :
if a>0 and b>0 then
//         :
if a>(0 and b)>0 then
// :
if (a>0) and (b>0) then
//       ,           ,     .
//          a>b>c   ,   Delphi     .
//    And          ,         .
//             ,  And        .

array
//Array      ,              .          2 .

//    
var
  Arr1: array [1..10] of Integer;

//    ,             ,         SetLength         
var
  Arr2: array of Integer;

//       ,          ,        ,    Length           
function X(A: array of Integer): Integer;
var
 i: Integer;
begin
  Result := 0;
  for i := 0 to Length(A)-1 do
  Result := Result + A[i];
end;

as
//As               
procedure BtnClick(Sender:TObject);
begin
  (Sender as TButton).Caption := 'Clicked';
end;

//           ,    As  
(HTTPRIO as IExp).GetConnection;

//As           ,          :
var
  i: Integer;
  s: string;
begin
  s := (i as string);
end;
//     :
s := string(i);

asm
//Asm           ,        ,     asm...end;   ,   begin...end;
function IntToHex(Value: Integer; Digits: Integer): string;
asm
  CMP  EDX, 32
  JBE  @A1
  xor  EDX, EDX
  @A1: PUSH ESI
  MOV  ESI, ESP
  SUB  ESP, 32
  PUSH ECX
  MOV  ECX, 16
  CALL CvtInt
  MOV  EDX, ESI
  POP  EAX
  CALL System.@LStrFromPCharLen
  ADD  ESP, 32
  POP  ESI
end;

assembler
//Assembler            ,  80386 .
//  Asm   :Asm    Win32  ,  Assembler   80x86  ,     Invoke     .
function IntToHex(AValue: Int64): string; assembler;

automated
//Automated                  ,              .
//ComObj              Automated     .
type
  TDemo = class
    automated
      Str:WideString;
  end;

//          ,  Str    ,   
type
  TDemo = class
    automated
      Str: AnsiString;
  end
//     Str          WideString   ,       AnsiString.
//      ,          ,     automated     .

begin
//begin                   ,    end      .
procedure X;
begin
  ShowMessage('A Demo');
end;

//     ,  If, For, While     begin           
for i:=1 to 100 do
begin
  sum := sum + i;
  if sum > 1000 then Break;
end;

case
//Case          , Case                ,     ,     ,     .
//Case     end  ,           ,     else       .
function GetDays(AYear,AMonth: Integer): Integer;
begin
  case AMonth of
    1,3,5,7,8,10,12: Result := 31;
    4,6,9,11: Result := 30;
    2: begin
    if IsLeapYear(AYear) then
      Result:=29
    else
      Result:=28;
    end;
  else
    Result:=0;
end;

cdecl
//Cdecl          ,      C C++   DLL             .
//    C C++         Delphi .
//  C++    :
int X(int i)
{
  return i*2;
}
//        Demo.dll ,  Delphi       :
function X(i: Integer): Integer; Cdecl; external 'Demo.dll';

class
//Class             ,             .
//  , Class              ,                 .
type
  ClassDemo = class(TObject)
    private
    public
      constructor Create;
  end;

//   class    ,                 ,   :
type
  ClassA = class
    private
    public
      procedure Y;
  end;

type
  ClassB = class(ClassA)
    private
    public
      class procedure X;
  end;
//     ClassA      ClassB X  
procedure ClassA.Y;
begin
  Self.X;
end;
//        class             .

const
//Const         ,   const               .
//           ,  const              .
const MyFileName = 'Delphi';
const MyInteger = 100;

// Const              ,          ,       .
//      const         
function X(const i: Integer): string;
//          , i      .

constructor
//constructor               ,        ,        
//       Create  , Create           CreateWnd  .
type
  ClassDemo = class(TObject)
    private
      fValue: Integer;
    public
      constructor Create;
  end;

constructor ClassDemo.Create;
begin
  fValue := 0;
end;

contains
//Contains         (Package)        .
// Contains               ,               .
package DATAX;
  requires
    rtl, clx;
  contains
    Db, DBLocal, DBXpress;
end.

default
//Default               
//                  ,                 .
type
  ClassDemo = class
    private
      fValue: Integer;
    published
      property Value: Integer read fValue write fValue default 0;
  end;

//              
property strings[Index: Integer]: string read GetString write PutString; Default;

destructor
//Destructor        ,               .
//         ,       .       Destroy     .
type
  ClassDemo = class(TComponent)
    public
      destructor Destroy;override;
  end;

//  TComponent    Destroy  ,        
//          ,     ,         :
destructor Destroy; overload;

dispid
//DispId      DispInterface   ,            .
// DispInterface   ,           , 
//     DispId,                      .
//          DispInterface      .
type
  IStringsDisp = dispinterface
    ['{EE05DFE2-5549-11D0-9EA9-0020AF3D82DA}']
    property ControlDefault[Index: Integer]: Olevariant dispid 0; default;
    function Count: Integer; dispid 1;
    property Item[Index: Integer]: Olevariant dispid 2;
    procedure Remove(Index: Integer); dispid 3;
    procedure Clear; dispid 4;
    function Add(Item: Olevariant): Integer; dispid 5;
    function _NewEnum: IUnknown; dispid -4;
  end;

dispinterface
//DispInterface              ,                        .
// DispInterface          ,       .
//DispInterface       ,          .
//    DispId            .
//DispInterface    Windows  ,    Linux     ,              .
//     ,    DispInterface.

//     DispId

div
//Div         .  Div             ,          .
var
  a,b,c:Integer;
begin
  a := 20; b := 3;
  c := a div b; {6}
end;

do
//Do     For, While, On, With  ,        

//For  :
for i := 1 to 100 do sum:=sum+i;

//While  :
while i < 100 do
begin
 sum := sum + i;
 Inc(i);
end;

//On  (    ):
try
 i := StrToInt(s);
except
 on exception do ShowMessage('Error!');
end;

//With  :
with Memo1.Lines do
begin
 Clear;
 Append('abc');
 Append('123');
end;

downto
//DownTo     For  ,           .
for i := 100 downto 1 do
  ListBox1.Items.Add(IntToStr(i));

// For   ,        To   ,    DownTo   .

dynamic
//Dynamic           , 
//         ,                (   Virtual).
procedure X(i: Integer); dynamic;

else
//else           ,     If, Case On    ,        ,   else   

//If  ( If   , else       ):
if a > b then
  c := a
else
  c:=b;

//Case  :
case Tag Of
  1:Result:=1;
  2:Result:=2;
  3:Result:=3;
else
  Result:=0;
end;

//On  (    ):
try
  i := StrToInt(s);
Excpet
  on EZeroDivide do Result := 1;
  on EOverflow do Result := 2;
else
  Result := 0;
end;

end
//End               .
//    begin, Case, Class, Interface, Asm, Unit, Package    .
//     (    ), End       .
//       (    ), end       .
// If   else     End        .
procedure X;
begin
 with Button1 do
 begin
  if Button1.ShowHint then
   Button1.Caption := 'Hinted'
  else
   Button1.Caption := 'Not Hinted';
 end;
end;

//     End   :
package DATAX;
  requires
    rtl,
    clx;
  contains Db, DBLocal, DBXpress;
end.

except
//except         ,     try   ,       ,    except    
try
  i := StrToInt(s);
except
  ShowMessage('Error!');
end;

export
//Export         ,          ,               .
//       dll           .       .
function Add(a,b: Integer): Integer; export;

//          Demo.exe,                ,         
function Add(a,b: Integer): Integer; stdcall; external 'Demo.exe';

exports
//exports      ,              ,          ,           .
library Demo;

function X(i: Integer): string; stdcall;
begin
 Result:=IntToStr(i);
end;

exports
 X;

begin
end.

//          ,           ,      .
library Demo;

function X(i: Integer): string; overload; stdcall;
begin
 Result := IntToStr(i);
end;

function X(s: string): Integer; overload; stdcall;
begin
 Result := StrToInt(s);
end;

exports
  X(i: Integer) name 'x1',
  X(s: string) name 'x2';

begin
end.

external
//External              OBJ    .
{$L Demo.OBJ}
procedure X(i:Integer);external;

//    dll        ,          :
function A(FileName: string): string; external 'Demo.dll';

//           ,             .
function A(Name: string): string; overload; stdcall; external 'Demo.dll' name 'A1';
function A(Code: Integer): string; overload; stdcall; external 'Demo.dll' name 'A2';

//  External    ,        ,        .

far
//Far         ,            .
//       dll           .       .
function Add(a,b: Integer): Integer; Far;

//          Demo.exe,                        ,         :
function Add(a,b: Integer): Integer; stdcall; external 'Demo.exe';

file
//File            ,         File, 
//   File   Of     ,                  .
type
  TPerson = record
    PName: string[32];
    PAge: Integer;
  end;
var
  PFile: file of TPerson;

finalization
//finalization                   , 
//                  ,      .
//finalization        OLE       .
initialization
  ActiveX.OleInitialize(nil);
finalization
  ActiveX.OleUninitialize;

finally
//finally                     , 
//        , finally       try       .
try
  Node := Node.GetNext;
  Edit1.Text := Node.Text;
finally
 Node := nil;
end;

for
//For     For    ,           .
for i := 1 to 100 do sum := sum + i;

//          ,     DownTo   
for i := 100 downto 1 do Inc(sum);

forward
//Forward            .       ,                .
//            ,             ,              .
function X(i: Integer): Integer; forward;
procedure Y(s: string); forward;
...
function X;
begin
  Result := i * 2;
end;

procedure Y;
begin
  WriteLn(s);
end;

// Forward                          ,          .

function
//Function      
function X(i: Integer): Integer;

//             
type
 TFun = function(i: Integer): Integer of object;

//     ,         ,                ,              .

goto
//Goto        ,                .
//       label       .
//  Goto          ,      .
var
 a,b: Integer;
label
 X,Y;
begin
 if a > b then
  goto X
 else
  goto Y;
X:
 WriteLn('a > b');
Y:
 WriteLn('b > a');
end;

if
//If     If    ,          .
var
 a,b: Integer;
begin
 a := 2; b := 3;
 if a>b then
  WriteLn('a=' + IntToStr(a))
 else
  WriteLn('b=' + IntToStr(b));
end;

//If        If...Then...else, else       .
// If           ,     begin...End      .
if a > b then
begin
 WriteLn('a>b');
 WriteLn('a=' + IntToStr(a));
 WriteLn('b=' + IntToStr(b));
End
else
 WriteLn('b>a');

implementation
//Implementation           ,         :
//Unit...Interface...implementation...end.
//   ,         implementation    .
//   implementation     ,         ,          .
implementation
  uses frmAbout;
begin
  FormAbout.Show;
end;

//           implementation  .

implements
//Implements            ,             .
//          ,          .
type
 IMyInterface = interface
  procedure P1;
  procedure P2;
 end;
 TMyImplclass = class
  procedure P1;
  procedure P2;
 end;
 TMyclass = class(TInterfacedObject, IMyInterface)
  FMyImplClass: TMyImplClass;
  property MyImplClass: TMyImplclass read FMyImplclass implements IMyInterface;
  procedure IMyInterface.P1 = MyP1;
  procedure MyP1;
 end;

//  implements   ,                  ,      :
procedure IMyInterface.P1 = MyP1;

in
//In                 .                       .
type
 TCol = (cA,cB,cC);
 TCols = set of TCol;
var
 Cols: TCols;
begin
 Cols := [cA,cB];
 if cA in Cols then
  ShowMessage('cA in Cols')
 else
  ShowMessage('cA not in Cols');
end;

//In        ,                 .
Uses
 Unit1 in 'Unit1.pas';

//In     For   ,               .
var
 s: string;
 sl: TStringList;
begin
 ...
 for s In sl do
 begin
  ShowMessage(s);
 end;
end;

index
//Index          ,           (Get,Set)          .
type
 TForm1 = class(TForm)
 private
  function GetInfo(const Index: Integer): Longint;
  procedure SetInfo(const Index: Integer; const Value: Longint);
 public
  property iLeft:Longint index 0 read GetInfo write SetInfo;
  property iTop:Longint index 1 read GetInfo write SetInfo;
  property iWidth:Longint index 2 read GetInfo write SetInfo;
  property iHeight:Longint index 3 read GetInfo write SetInfo;
 end;

function TForm1.GetInfo(const Index: Integer): Longint;
begin
 case Index of
  0: result := self.Left;
  1: Result := self.Top;
  2: result := self.Width;
  3: result := self.Height;
 end;
end;

//Index                ,   :
property Selected[Index: Integer]: Boolean read GetSelected write SetSelected;

inherited
//Inherited         .
type
 TDemo = class(TComponent)
 public
  constructor Create(AOwner: TComponent); override;
 end;

constructor TDemo.Create(AOwner: TComponent);
begin
 inherited Create(AOwner);
end;

//              ,             .     
inherited Create(AOwner);
//    :
Inherited;

initialization
//initialization                   , 
//                  ,      .
//initialization        OLE      .
initialization
  ActiveX.OleInitialize(nil);
finalization
  ActiveX.OleUninitialize;

inline
//InLine     Asm assembler   , 
//               .              .
function IntToStr(Value: Integer): string;
asm
 InLine;
  PUSH  ESI
  MOV   ESI, ESP
  SUB   ESP, 16
  xor   ECX, ECX
  PUSH  EDX
  xor   EDX, EDX
  CALL  CvtInt
  MOV   EDX, ESI
  POP   EAX
  CALL  System.@LStrFromPCharLen
  ADD   ESP, 16
  POP   ESI
end;

interface
//Interface           ,         :
//Unit...Interface...implementation...end.
//  ,           Interface    .
//   Interface     ,          ,          .
Interface
 uses frmAbout;
var
 FAbout: TFormAbout;
begin
 FAbout := TFormAbout.Create(Self);
 FAbout.Show;
end;

//           Interface  .

//Interface          .
type
 IMalloc = interface(IInterface)
 ['{00000002-0000-0000-C000-000000000046}']
  function Alloc(Size: Integer): Pointer; stdcall;
  function Realloc(P: Pointer; Size: Integer): Pointer; stdcall;
  procedure Free(P: Pointer); stdcall;
  function GetSize(P: Pointer): Integer; stdcall;
  function DidAlloc(P: Pointer): Integer; stdcall;
  procedure HeapMinimize; stdcall;
 end;

is
//Is          ,       ,     "As"  .
var
 Comp: TComponent;
begin
  ...
 if Comp Is TEdit then
  (Comp as TEdit).Text := 'Edit';
end;

label
//label           ,    Goto    ,      .
var
 a,b: Integer;
label
 X,Y;
begin
 if a > b then
  goto X
 else
  goto Y;
X:
 WriteLn('a>b');
Y:
 WriteLn('b>a');
end;

library
//Library              .       DLL  ,         .
library Editors;
uses EdInit, EdInOut, EdFormat, EdPrint;
exports
  InitEditors,
  doneEditors name done,
  InsertText name Insert,
  DeleteSelection name Delete,
  FormatSelection,
  PrintSelection name Print,
  SetErrorHandler;
begin
  InitLibrary;
end.

message
//Message           , 
//  Message              ,              ,       .
procedure Refresh(var Msg: TMessageRecordtype); message ID_REFRESH;

procedure Refresh(var Msg: TMessageRecordtype);
begin
  if Chr(Msg.Code) = #13 then
    ...
  else
    inherited;
end;

//         ,          Message  ,      .

mod
//Mod         ,    .  Mod             ,          .
var
 a,b,c: Integer;
begin
 a := 20; b := 3;
 c := a mod b; {2}
end;

name
//Name            , 
//             ,    Name      ,                 .
//          ,         ,     Name    .
function MessageBox(HWnd: Integer; Text, Caption: PChar; Flags: Integer): Integer; 
  stdcall; external 'user32.dll' name 'MessageBoxA';

near
//Near         ,            .
//       dll           .       .
function Add(a,b: Integer): Integer; near;

//          Demo.exe,                     ,         :
function Add(a,b: Integer): Integer; stdcall; external 'Demo.exe';

nil
//Nil         ,          .
while Node <> nil do
begin
 ListBox1.Items.Add(Node.Text);
 Node := Node.GetNext;
end;

nodefault
//NoDefault                 ,         .
type
 TClassA = class
 private
  fValue: Integer;
 published
  property Value: Integer read fValue write fValue default 0;
 end;

 TClassB = class(TClassA)
 published
  property Value:Integer read fValue write fValue nodefault;
 end;

//     , TClassA  Value    0, 
//TClassB   TClassA,           ,    NoDefault     

not
//Not    ,          .  :
if a > b then
//    :
if not(a < b) then

//Not         Boolean    
procedure Button1Click(Sender: TObject);
begin
 StatusBar1.Visible := not StatusBar1.Visible;
end;

object
//Object        ,           ,       .Object   Object   .
//                  .
type
 ODemoA = object
 end;

 ODemoB = object(ODemoA)
 end;

//Object               ,   :
type
 TMyFun = function(i: Integer): Integer of Object;
 TMyProc = procedure(s: string) of object;

//  object                       ,            .

of
//Of                 .Of   Case, Class, Array, File, Set, Object  .

//Case  :
case Tag Of
 0: Result := 'a';
 1: Result := 'b';
end;

//Class  :
type
 TDemo = class of TComponent;

//Array  :
var
 MyInt: array of Integer;

//File  :
var
 MyFile: file of Byte;

//Set  :
type
 TCol = (cA,cB,cC);
 TCols = set of TCol;

//Object  :
type
 MyFun = function(I: Integer): Integer of Object;

on
//On         ,        ,        .
try
 i := StrToInt(s);
except
 on E: exception do
  ShowMessage(E.Message);
end;

or
// 、     
if (a>0) or (b>0) then

// 、     
var
  a,b,c: Integer;
begin
  c := (a or b);
end;

//  Or     , Or              ,           
//           Or,            Or   
  :
if a>0 or b>0 then
//         :
if a>(0 or b)>0 then
//  
if (a>0) or (b>0) then
//       ,           ,     
//          a>b>c   ,   Delphi     
//    Or          ,         .
//             ,  Or        .

out
//Out               ,              , 
//  Out              .
//Out var  , Out              ,  var            .
procedure X(out i: Integer; out s: string);
begin
 i := i * 2;
 s := s + 'abc';
end;

procedure TForm1.Button1Click(Sender: TObject);
var
 i: Integer;
 s: string;
begin
 i := 20;
 s := 'xxx';
 X(i,s);
end;

overload
//Overload             ,         , 
//      ,        ,           .
function X(i: Integer): string; overload;
function X(s: string): string; overload;

//      ,               ,      overload    , 
//                .
type
 TDemo = class(TComponent)
 public
  procedure CreateWnd(AOwner: TWinControl); overload;
 end;

//   ,         :
procedure CreateWnd; {     }
procedure CreateWnd(AOwner: TWinControl); {    }
//   CreateWnd  .

//       ,               .

override
//Override      Virtual  Dynamic     .
//               ,                   .
procedure Create(AOwner: TComponent); override;

//Override     ,            .
type
 TClassA = class
  procedure X; virtual;
 end;

 TClassB = class(TClassA)
  procedure X; override;
 end;

//   ,         :
procedure X; {     }
//        :
procedure X; {      ,     }

//         Virtual Dynamic  , 
//          ,     Reintroduce       .

package
//Package               .
//        BPL  ,      Delphi     ,              .
package DATAX;
  requires
    rtl,
    clx;
  contains
    MyUnit in 'C:\MyProject\MyUnit.pas';
end.

packed
//Packed                  ,                 .
type
 TPerson = packed Record
  PName: string[32];
  PAge: Integer;
 end;
 MyArray: packed array of PChar;

pascal
//Pascal         , 
//          Pascal  ,              , 
//               .       .
function X(i: Integer): Integer; Pascal;
begin
 Result := i * 2;
end;

private
//Private              ,  Private              .

procedure
//Procedure      
procedure X(i: Integer);

//             
type
 TProc = procedure(i: Integer) of object;

//     ,         ,           ,              .

program
//Program                .        exe  ,       
program Project1;
uses
  Forms,
  Unit1 in 'Unit1.pas' ;
{$R *.res}
begin
  Application.Initialize;
  Application.CreateForm(TForm1, Form1);
  Application.Run;
end.


property
//Property         ,                , 
//     published               ,              .
type
 TDemo = class
 Private
  fValue: Integr;
 Published
  property Value: Integer read fValue write fValue;
 end;

//         ,    published     Property    
type
 TOnTextChange=procedure (Sender: TObject) of object;
 TDemo = class
 private
  fEvent: TOnTexChange;
 published
  property OntextChange: TOnTextChange read fEvent write fEvent;
 end;

protected
//Protected              ,  Protected                  .

public
//Public              ,  Public                   .

published
//Published              .
// Published               RTTI    
//     Published                          .

raise
//Raise        , 
//              ,                ,     Raise  .
function GetString(i: Integer): string;
begin
 if i < 0 then
  raise exception.Create('Integer Cannot smaller than 0');
 Result := IntToStr(i);
end;

//      ,         
try
 i := StrToInt(s);
except
 on E: exception do
  raise exception.Create(E.Message);
end;

read
//Read                  .
private
 fValue: Integer;
published
 property Value: Integer read fValue;

//      Value     fValue     .

readonly
//ReadOnly               .
property ReadOnly;

// ReadOnly  True ,            ,            .

record
//Record              , 
//                    ,        .
type
 TPerson = record
  PName: string[32];
  PAge: Integer;
 end;

register
//Register         ,                     .       .
function Add(a,b: Integer): Integer; Register; Register

//            IDE          .
procedure Register;
begin
 RegisterComponents('Sample', [TDemo]);
end;

reintroduce
//Reintroduce        ,        , 
//             ,             ,    Reintroduce     .
//  Virtual Dynamic  ,      Override    .
type
 TClassA = class
  procedure X;
 end;
 TClassB = class(TClassA)
  procedure X; reintroduce;
 end;
 TClassC = class(TClassB)
  procedure X(i: Integer); reintroduce;
 end;

repeat
//repeat       repeat    , 
//             ,             .repeat   Until       .
i := 0;
repeat
 sum := sum + i;
 Inc(i);
until(i >= 100);

requires
//Requires        Package      . Requires      ,        .
package DATAX;
  requires
    rtl,
    clx;
end.

resourcestring
//ResourceString         ,                  .
ResourceString
 CreateError = 'Cannot create file %s';
 OpenError = 'Cannot open file %s';
 LineTooLong = 'Line too long';
 ProductName = 'Borland Rocks';
 SomeResourceString = SomeTrueConstant;

safecall
//Safecall          ,      COM             .
//    , Safecall         COM     .
procedure X(s: WideString); safecall;

//      :
procedure X(s: PAnsiString);

set
//Set          ,            ,  in     .
type
 TCol = (cA,cB,cC);
 TCols = set of TCol;

//                       
var
 Cols: Tcols;
begin
 Cols := Cols + [cA,cB];
end;

shl
//SHL      ,         2   
var
 x: Integer;
begin
 X := 2 shl 3; {16}
end;

shr
//SHR      ,         2   
var
 x: Integer;
begin
 X := 16 shr 2; {4}
end;

stdcall
//Stdcall          ,                     .
//Stdcall                   .

//  ,      :
Library Demo;
function X(i: Integer): Integer; stdcall;
begin
 Result := i * 2;
end;
exports
 X;
begin
end.

//     :
function X(i: Integer): Integer; stdcall; external 'Demo.dll';

//      ,   Stdcall    ,            ,        .

stored
//Stored                ,     True,                 .
property Value: string read fValue write fValue stored True;

string
//String       ,        .
var
 Str: string;

then
//Then     If   ,  If     ,   Then    .
var
 a,b: Integer;
begin
 if a > b then
  WriteLn('a')
 else
  WriteLn('b');
end;

threadvar
//Threadvar                , 
//   Threadvar    ,                    .
threadvar S: AnsiString;
S := 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
S := '';

//S := '';      S      .

to
//To     For  ,           .
for i := 10 to 100 do
 ListBox1.Items.Add(IntToStr(i));

// For   ,        To   ,    DownTo   .

try
//try        ,             ,     try   ,           .
try
 i := StrToInt(s);
except
 ShowMessage('Error');
end;

type
//Type           ,  Type        ,          .
type
 TDemo = class
 end;

//type                   .
type
 TCol = (cA,cB,cC);
 TInt = Integer;

unit
//Unit        ,          Unit...Interface...implementation...end.
Unit Unit1;
Interface
 uses Classes;
implementation
end.

//           Unit    .

until
//Until       repeat         , 
//        ,      .Until   repeat       .
i := 0;
repeat
 sum := sum + i;
 Inc(i);
until(i >= 100);

uses
//Uses           ,                .
//Uses                   .
Interface
 uses Classes;
Implemention
 uses frmAbout;

var
//var               ,  var         .
var
 i: Integer;
 s: string;

//var                 
function X(var i: Integer): Integer;

//        i      ,               ,        .

varargs
//varArgs       ,     Cdecl     ,                .
function printf(Format: PChar): Integer; cdecl; varargs;

//     C++       Printf  ,              .

virtual
//Virtual         , 
//        ,                 (   Dynamic).
procedure X(i: Integer); virtual;

while
//While       While    ,              ,            .
i := 0;
while i < 100 do
begin
 sum := sum + i;
 Inc(i);
end;

with
//With                 ,               ,           .
with Form1.Memo1.Lines do
begin
 Clear;
 Append('abc');
 Append('def');
 SaveToFile('C:\demo.txt');
end;

//           With  ,                  :
Form1.Memo1.Lines.Clear;
Form1.Memo1.Lines.Append('abc');
Form1.Memo1.Lines.Append('def');
Form1.Memo1.Lines.SaveToFile('C:\demo.txt');

write
//Write                  .
private
 fValue: Integer;
published
 property Value: Integer write fValue;

//      Value       fValue   .

writeonly
//writeonly               .
property writeonly;

// writeonly  True ,          ,            .

xor
//Xor     ,          ,   False,      True.
var
 a,b: Integer;
begin
 a := 2; b := 3;
 if a xor b then
  WriteLn('a xor b')
 else
  WriteLn('a not xor b');
end;

//Xor        
WriteLn(IntToStr(3 xor 5)); {6}

좋은 웹페이지 즐겨찾기