Is there a way to use “type” word as a variable name in Scala?

后端 未结 1 675
时光说笑
时光说笑 2020-12-07 00:14

It is frequent in my practice that a variable/argument is to store a type of something (as an enumeration value usually). And it usually makes no sense to specify an entity

1条回答
  •  甜味超标
    2020-12-07 01:19

    You can escape with backticks:

    val `type` = 5
    

    0 讨论(0)
提交回复
热议问题