表达式
表达式是一个值(常量、预定义常量、变量或函数的结果),根据值的类型,可以选择在其前面添加某些运算符,后跟一个运算符和另一个值,依此类推。
对于数字表达式:
{ number
| constant
| numeric function
| numeric variable
} [ operator
[ sign
] { number
| numeric function
| numeric variable=} ... ]
number : a standard number
constant : a constant that represents a numeric value
numeric function : a user-defined or
内部函数 that returns a numeric value
operator : any of the standard [/cat/arithop|arithmetic operators] (
+
-
*
/
^
\
lang/div
lang/mod
plus
AND
OR
or
XOR
)
numeric variable : any variable whose value is a number
对于字符串表达式:
{ string
| string constant
| string function
| string variable=} [ & { =string
| string constant
| string function
| string variable=} ... ]
string : a set of zero or more characters surrounded by "
string constant : a
predefined constant that represents a string value
string function : a user-defined or
内部函数 that returns a string value
string variable : any variable whose value is a string
& : 表示将与号右侧的字符串值连接到与号右侧的值的末尾。
对于布尔表达式:
[ [/lang/not]
] { TRUE
| FALSE
| numeric constant
| boolean constant
| boolean function
| boolean variable
} [ boolean operator
[ NOT
] { TRUE
| FALSE
| numeric constant
| boolean constant
| boolean function
| boolean variable
} ... ]
NOT : using
NOT
before a boolean value reverses the value
TRUE or
FALSE : the standard boolean constants
numeric constant : a
/wiki/cat/number|standard number which will be resolved to either
TRUE
or
FALSE
[1]
boolean constant : a
/wiki/cat/constant|predefined constant that represents a boolean value
boolean function : a user defined or
内部函数 that returns
TRUE
or
FALSE
or resolves to
TRUE
or
FALSE
[1]
boolean variable : any variable whose value is
TRUE
or
FALSE
or resolves either to
TRUE
or
FALSE
[1]
boolean operator:
AND
OR
XOR
=
<>
<
>
<=
>=
注意如果一个表达式包含一个数字后面跟着
AND,
OR
, 或
XOR
和一个数字组成,则它将被视为算术表达式而不是布尔表达式。表达式中的至少一个值必须是布尔值才能生成布尔表达式。
[1]
请注意,
/wiki/cat/number,
/wiki/cat/constant|predefined constant,
/wiki/cat/arith|arithmetic function 函数或数值变量可以用作布尔值。如果布尔表达式中使用的数字、数值常量、数值函数或变量的值为零,则解析为
FALSE
; 布尔表达式中使用的所有其他数值解析为
TRUE
。
参见