例如你要写一句赋值语句,你可以声明任何类型的变量,在等号的左边使用任何标识符,然后在右边给出任何的表达式。
In writing an assignment statement, for example, you can declare variables of any type, use any identifier to the left of the equal sign, and supply any expression on the right.
只有在赋值和调用时,表达式才应被当作一条单独的语句。
The only expressions that should be used as statements are assignments and invocations.
这是本例子第一次把关联作为一个定义表达式(换句话说,一个赋值语句)的声明性陈述来使用,而不是用它作模型到模型的映射。
This is the first time that this example is using a relation as a declarative statement to define an expression (in other words, a value assignment) instead of using it for model-to-model mapping.
就像前面语句中n1 +n2这个表达式一样,这次也是通过一条含有+的表达式来赋值的。
Just like the n1 + n2 expression from the previous statement, this value is given by an expression involving the + operator.
Lua允许使用多种赋值语句,可以先对表达式进行求值,然后再进行赋值。
Lua allows multiple assignments, and expressions are evaluated first and are then assigned. For example, the statements
和表达式一样,避免写复杂的模板语句。常规是函数调用或者属性赋值。
As with expressions, avoid writing complex template statements. A method call or simple property assignment should be the norm.
方括号内的表达式是一个元组。我们可以用元组赋值语句来遍历这个字典。
The expression in brackets is a tuple. We could use tuple assignment to traverse this dictionary.
一般来讲,你可以用条件表达式来替换掉条件语句,无论这些语句的分支是返回语句或者是赋值语句。
In general, you can replace a conditional statement with a conditional expression if both branches contain simple expressions that are either returned or assigned to the same variable.
如果相应语句为某个表达式赋值,请用一个可写的变量、属性或数组元素替换该表达式。
If the statement assigns a value to an expression, replace the expression with a single writable variable, property, or array element.
如果相应语句为某个表达式赋值,请用一个可写的变量、属性或数组元素替换该表达式。
If the statement assigns a value to an expression, replace the expression with a single writable variable, property, or array element.
应用推荐