英文:
What is the essential difference between keyword and predeclare name in Go
问题
Go语言有25个关键字,比如if和switch,只能在语法允许的地方使用;它们不能用作名称。
此外,还有大约三十多个预定义的名称,比如int和true,用于内置的常量、类型和函数。
英文:
Go has 25 keywords like if and switch that may be used only where the syntax permits; they can’t be used as names.
In addition, there are about three dozen predeclared names like int and true for built-in con- stants, types, and functions
答案1
得分: 2
它们只是标识符,可以自动为您提供。
当然,您可以更改它们,因为它们只是预定义的标识符,而不是其他语言结构。
var bool int = 42
fmt.Println(bool)
// 42
https://go.dev/play/p/Mh7MF6If6oy
英文:
They are just identifiers, universally available for you automatically.
Of course, you can change them since they are just predefined identifiers, not a language construct as others.
var bool int = 42
fmt.Println(bool)
// 42
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论