变量定义
variable_name := <value>
变量定义可以被遮蔽
variable_name := <value1>
variable_name := <value2>
变量的定义同时也是表达式,其值为: <value>
错误的左值应该引发报错:
10 := 20
-------
DeclareError: invalid left-hand value.
变量赋值
variable_name = <value>
变量必须先定义才能被赋值,在全局作用域允许不经定义直接赋值
@_() {
# in a function, function name is ignored
<variable-name-that-is-undefined> = <value>
# AssignmentError: undefined variable "<variable-name-that-is-undefined>".
}
# directly assignment is allowed in global scope
<variable-name-that-is-undefined> = <value>
变量的赋值同时也是表达式,其值为: <value>
错误的左值应该引发报错:
10 = 20
-------
AssignmentError: invalid left-hand value.