559 B
559 B
title | localeTitle |
---|---|
Constants | 常量 |
常量
常量将名称与特定类型的值相关联。
例:
let name = "Chris Lattner"
使用let
关键字声明常量然后为其指定name
然后使用赋值运算符=
将值"Chris Lattner"
赋值给常量name
。
一旦声明了常量,就不再需要使用let
关键字了,只需按名称调用它即可。
一旦设定,就不能改变常数的值。