天天看点

Scala变量和常量的声明

Scala变量和常量的声明
Scala变量和常量的声明
Scala变量和常量的声明

标示符的命名规则

1. 字母或下划线开头

2. 以操作符开头,且只包含操作符(+ - * / # !等)

3. 用反引号`....`包括的任意字符串,即使是 Scala 关键字(39 个)也可以

• package, import, class, object, trait, extends, with, type, for

• private, protected, abstract, sealed, final, implicit, lazy, override

• try, catch, finally, throw

• if, else, match, case, do, while, for, return, yield

• def, val, var

• this, super

• new

• true, false, null

作者:​​靠谱杨​​​

我可能不是天才,但我会努力成为人才。

更多日常分享尽在我的VX公众号:小杨的挨踢IT生活