An expression is a construction that returns a value. For example,
X {
variable }
@X {
address of a variable }
15 {
integer constant }
InterestRate { variable }
Calc(X,Y) {
function call }
X * Y {
product of X and Y }
Z / (1
- Z) {
quotient of Z and (1 - Z) }
X =
1.5 {
Boolean }
C in
Range1 {
Boolean }
not
Done {
negation of a Boolean }
['a','b','c'] { set }
Char(48) {
value typecast }
The simplest expressions are variables and constants (described in Data types, variables, and constants). More complex expressions are built from simpler ones using operators, function calls, set constructors, indexes, and typecasts.
一个表达式就是一个能够返回值的结构。例如:
X {
变量 }
@X {
变量的地址 }
15 {
整型常量 }
InterestRate { 变量 }
Calc(X,Y) { 函数调用 }
X * Y {
X与Y的乘积 }
Z / (1
- Z) { Z与(1 - Z)的商
}
X =
1.5 {
布尔值 }
C in
Range1 { 布尔值 }
not
Done {
否定的布尔值 }
['a','b','c'] { 集合 }
Char(48) {
值类型转换 }
最简单的表达式是变量和常量(详细描述见数据类型、变量和常量)。通过使用运算符、函数调用、集合构造器、索引以及类型转换等,可以建立复杂的表达式。