mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-12 07:02:11 +08:00
04.3.md
This commit is contained in:
@@ -61,8 +61,6 @@
|
|||||||
c = iota
|
c = iota
|
||||||
)
|
)
|
||||||
|
|
||||||
The first use of iota gives 0, whenever iota is used again on a new line, its value is incremented by 1; so a=0, b=1, c=2. This can be shortened to:
|
|
||||||
|
|
||||||
第一个 `iota` 等于 0,每当 `iota` 在新的一行被使用时,它的值都会自动加 1;所以 `a=0, b=1, c=2` 可以简写为如下形式:
|
第一个 `iota` 等于 0,每当 `iota` 在新的一行被使用时,它的值都会自动加 1;所以 `a=0, b=1, c=2` 可以简写为如下形式:
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -102,8 +100,6 @@ The first use of iota gives 0, whenever iota is used again on a new line, its va
|
|||||||
VIOLET // 6
|
VIOLET // 6
|
||||||
)
|
)
|
||||||
|
|
||||||
Remark: There is a convention to name constant identifiers with all uppercase letters, like: `const INCHTOwCM = 2.54`; this improves readability and can be used as long as it is not in conflict with the Visibility Rule of §4.2
|
|
||||||
|
|
||||||
**注意事项** 作为约定,常量的标识符主要使用大写字母,标识符中各个部分的连接字符可用小写字母以便区分,如:`const INCHTOwCM = 2.54`;这样不仅增强了可读性,而且不会与第 4.2 节中描述的可见性规则冲突。
|
**注意事项** 作为约定,常量的标识符主要使用大写字母,标识符中各个部分的连接字符可用小写字母以便区分,如:`const INCHTOwCM = 2.54`;这样不仅增强了可读性,而且不会与第 4.2 节中描述的可见性规则冲突。
|
||||||
|
|
||||||
##链接
|
##链接
|
||||||
|
Reference in New Issue
Block a user