I. Data type: (1) Basic data type: a, integer type: (General type <32 digits>: integer- Symbol; cardinal- unsigned) specific: Sign: Shortint <8>, Smallint <16 >, Longint <32-bit> No Symbol: Byte <8-bit>, Word <16-bit>, LongiWord <32-bit> B, Character Type: (General Type <8>: Char - with Ansichar) Specific: Ansichar < 8-bit>: Mainly stores ANSI character widechar <16-bit>: Mainly store Unicode Character C, Boolean: (General Type <8>: Boolean- with ByteBool) Specific: Bytebool <8>, WordBool <16> LongBool <32-bit> Different Boolean types are mainly used for other programming languages and different Windows systems. d, Enumeration Type: Definition: TYPE Enumeration Type Identifier = (Key1 [= VAL1], ...., Keyn [= VALN]): N <= 255 If you specify a value for some Key, no specified The value of the key is the previous key value plus 1; if all the defaults are not specified, the key1 value is 0, and 1 will be added one by one.
e, subjuntet type: Definition: TYPE sub-boundary type identifier = lower bound. . The lower bound is as: Type Subint = 1. . 3 0; represents an integer type subchar = 'A' of 1 to 30. . 'z'; indicates characters
※ Note: 1, the above four types are called ordered types, that is, in addition to the first number, there is a first number of lines, in addition to the last number, there is a successor number. it's here
(In the computer), the integer is limited. The number of ordered types has a serial number called the order. The number of integers is itself, other types of first
The number of numbers is 0 and increment sequentially. 2, on the sub-boundary type, the lower bound must have the same ordered type, and the upper order is greater than the lower sequence. f, floating point type: (General type <8 bytes>: real- with double equivalents) specific: double <8 bytes>, Real48 <6 bytes> Single <4 bytes>, Extended <10 bytes>, CoMP <8 bytes>, Currency <8 bytes>
g, String Type: (General Type: String- and ANSISTRING) Specific: ShortString: Up to 255 characters, the first one stores the character, not the NULL end ANSISTRING: Store the ANSI character, with NULL end WideString: Store unicode characters, ending h, time, date type: tdatetime - actually called the floating point type: A, pointer type: definition: TYPE pointer type identifier = ^ Basic type; Inner Assignment: New () memory release: destroy () For Pointer and Pchar with getMem () or allocMem () allocated memory, use FreeMem () to release the memory allocated memory, you can use the basic type: Pointer type identifier ^
It actually uses the pointer: VAR variable identifier: ^ basic type; after the variable distribution can be used as a normal variable.
b, record type: Definition: TYPE Record Type Identifier = Record Field 1: Type; . . Field N: Type; END;
C, Collection Type: Definition: Type Collection Type Identifier = Subsequiry or sub-boundary type of SET OF Basic Type; (<= 255 elements)
d, variant (general) type: Variant;
(3) Array type: a, one-dimensional array: definition: TYPE array identifier = array [subscript limit. . The upper limit of the subscript is the basic type;
b, multiple arrays: definition: Type array identifier = array [lower limit 1. . Limit 1 ,. . . , Lower N. . Limit N] OF Basic Type;
c, dynamic array (variable): VAR identifier: Array Of basic type; setLength (identifier, number); // Assign space identifier: = nil; // Release
Second, the statement first wants to say begin ... End; equivalent to {...} in C or C . (1) Statement statement constant: constant identifier [: Type] = Factory; Variable: VAR Variable Identifier: Data Type; (2) The legitimate clause operator consisting of expression statement by operator: operator priority Level @ NOT 1 (highest) *, /, div, mod, and, shl, shr, as, 2 , -, or, xor 3>, <,> =, <=, <>, =, in, IS 4 (minimum) (3) with ... The END statement is mainly used when operating the record type or component. Example: Type People = Record // Define Record People Name: String; Addr: String; Age: Integer; Sex: String; End; Var Me: People; // Define the PEOPLE type Variable with me do begin name: = 'Paul '; Addr: =' guangzhou '; Age: = 23; SEX: =' Male '; end; (4) GOTO statement Now all sounds are to reduce the goto statement is used, so as little as possible is. Example: label mylabel; // Reserved by Label MYLabel
Mylabel: // Tag ,, / / Other statement goto mylabel; // Jump to MyLabel (5) Conditions statement A, IF ... Then ... statement if Boolean expression Then ..; or if Boole THEN BEGIN ... END; other format: if ... then ... else ...; if ... then .. elseness ...1 ... else ...; b, cas .. . Of the statement case expression OF value 1: ... Value 2: ... Value N: ... END; 6) Cycle Schedule A, For ... TO ... DO statement for loop variable: = Initial value TO final value DO ...; or for loop variable: = initial value TO final value DO Begin. . . End; b, while ... DO statement while Boolean expressions do ...; or while Boolean expression do beg ... End; C, REPEAT ... Until statement REPEAT ... Until Boolean expression; (7 Cyclic interrupt break: End of cycles: End this loop GOTO: () EXIT: Exit the current function or process Halt (): Terminate the entire program, the parameter is an integer runerror (): (): 3, process and function ( 1) Process (no return value) declaration: Procedure
Second, the statement first wants to say begin ... End; equivalent to {...} in C or C . (1) Statement statement constant: constant identifier [: Type] = Factory; Variable: VAR Variable Identifier: Data Type; (2) The legitimate clause operator consisting of expression statement by operator: operator priority Level @ NOT 1 (highest) *, /, div, mod, and, shl, shr, as, 2 , -, or, xor 3>, <,> =, <=, <>, =, in, IS 4 (minimum) (3) with ... The END statement is mainly used when operating the record type or component. Example: Type People = Record // Define Record People Name: String; Addr: String; Age: Integer; Sex: String; End; Var Me: People; // Define the PEOPLE type Variable with me do begin name: = 'Paul '; Addr: =' guangzhou '; Age: = 23; SEX: =' Male '; end; (4) GOTO statement Now all sounds are to reduce the goto statement is used, so as little as possible is. Example: label mylabel; // Reserved by Label MYLabel