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

posted @ 2021-12-30 21:45  靠谱杨  阅读(83)  评论(0编辑  收藏  举报