天天看點

Scala 中的val 與 var 的差別 immutable 與 mutable 的 差別

A balanced attitude for Scala programmers

Prefer vals, immutable objects, and methods without side effects.

Reach for them first. Use vars, mutable objects, and methods with side

effects when you have a specific need and justification for them.