Often a variable is only assigned to once and is used as an (immutable) definition.
通常对变量的赋值只有一次,并被当作不变的对象。
Scala allows you to decide whether a variable is immutable (read-only) or not (read-write) when you declare it.
当你声明一个变量的时候,Scala允许你来决定它是不变的(只读的)还是可变的(可读写的)。
An immutable "variable" is declared with the keyword val (think value object).
一个不变的“变量”可以用val关键字来声明(想象一个值对象)。
应用推荐