'What is the essential difference between keyword and predeclare name in Go

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

go


Solution 1:[1]

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

https://go.dev/play/p/Mh7MF6If6oy

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 ferhatelmas