- Let
Let
let
语句用于可变变量、属性和数组。 变量默认是不可变的,并且该指令使它们在语句的作用域内是可变的:
let name = "Tony"; // simple variable
let this->name = "Tony"; // object property
let data["name"] = "Tony"; // array index
let self::_name = "Tony"; // static property
此指令也必须用于递增/递减变量:
let number++; // increment simple variable
let number--; // decrement simple variable
let this->number++; // increment object property
let this->number--; // decrement object property
可以在单个` let </ 0>操作中执行多个突变:</p>
let price = 1.00, realPrice = price, status = false;
`</pre>