gpt4 book ai didi

scala - 在 Scala 代码中使用全部大写字母

转载 作者:行者123 更新时间:2023-12-01 09:55:22 25 4
gpt4 key购买 nike

Java 中的常见做法是对静态最终变量使用全部大写:

static final int MY_CONSTANT = 24

我相信 Scala 中 val 的常见做法是使用:

val MyConstant = 24

在 Java 和 Scala 中是否有可以接受的地方使用全部大写?

最佳答案

根据 the official guidelines :不。在实践中 ALL_CAPS 通常表示“全部大写,由下划线分隔”,Scala 确实不希望您在名称中使用下划线。

Generally speaking, Scala uses “camelCase” naming conventions. That is, each word (except possibly the first) is delimited by capitalizing its first letter. Underscores (_) are heavily discouraged as they have special meaning within the Scala syntax.

关于scala - 在 Scala 代码中使用全部大写字母,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29173315/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com