Keywords or reserved keywords in a language are words that cannot be used for any purpose other than they are intended to. So, we cannot use them as the variable name or any other identifiers.
There are 25 such keywords in Go Language
break | default | func | interface | select |
case | defer | go | map | struct |
chane | else | goto | package | switch |
const | fallthrough | if | range | type |
continue | for | import | return | var |
In our Hello world program, too, it can be seen that we have used the three keywords there only. So, it’s safe to say that even the small programs require keywords.
package main
import "fmt"
func main() {
fmt.Println("Hello World!")
}
The above program contains three keywords – package, import, and “func“.
We will be looking at all of the keywords in our upcoming posts.