Originale-mail to me for new edition

 

Assignment statements

 

An assignment statement has the form

variable := expression

where variable is any variable reference including a variable, variable typecast, dereferenced pointer, or component of a structured variable and expression is any assignment-compatible expression. (Within a function block, variable can be replaced with the name of the function being defined. See Procedures and functions.) The := symbol is sometimes called the assignment operator.

An assignment statement replaces the current value of variable with the value of expression. For example,

I := 3;

assigns the value 3 to the variable I. The variable reference on the left side of the assignment can appear in the expression on the right. For example,

I := I + 1;

increments the value of I. Other assignment statements include

X := Y + Z;

Done := (I >= 1) and (I < 100);

Hue1 := [Blue, Succ(C)];

I := Sqr(J) - I  * K;

Shortint(MyChar) := 122;

TByteRec(W).Hi := 0;

MyString[I] := 'A';

SomeArray[I + 1] := P^;

TMyObject.SomeProperty := True;

 

Topic groups

 

See also

Simple statements

 

 

译文

 

赋值语句

 

赋值语句具有如下形式

variable := expression

这里的variable是任何一个变量引用,包括变量、变量类型转换、解除参照的指针或结构变量的组成部分,expression是任何赋值兼容的表达式。(在函数块中,variable可以被所在定义函数的函数名代替,见过程和函数。)符号 := (冒号之后紧随等号)有时也叫做赋值运算符。

赋值语句用表达式expression的值替换变量variable当前的值。例如,赋值语句

I := 3;

把数值3赋给变量 I 。赋值语句左边的变量引用可以出现在右边的表达式中,例如,赋值语句

I := I + 1;

增加了变量 I 的值。下面是赋值语句的范例:

X := Y + Z;

Done := (I >= 1) and (I < 100);

Hue1 := [Blue, Succ(C)];

I := Sqr(J) - I  * K;

Shortint(MyChar) := 122;

TByteRec(W).Hi := 0;

MyString[I] := 'A';

SomeArray[I + 1] := P^;

TMyObject.SomeProperty := True;

 

主题组

 

相关主题

简单语句