Golang is a programming language that has gained significant popularity in recent years due to its simplicity and readability of syntax, supported by the use of keywords.
Keyword - Keywords or reserved words are words in the language that are used for some internal processes or represent some predefined actions. Therefore, these words are not allowed to be used as identifiers. Doing so will result in compilation errors. Here is what you need to know about keywords in Golang .

For example:
// Minh họa chương trình Go sử dụng từ khóa
package main
import "fmt"
// Từ khóa ở đây là package, import, func, var
func main() {
// Đây là một biến hợp lệ
var a = "Quantrimang"
fmt.Println(a)
// Ở đây, mặc định là một
// định danh không hợp lệ và
// trình biên dịch sẽ đưa ra lỗi
// var default = "GFG"
}
Result:
Quantrimang
Go programming currently has a total of 25 keywords:

- break − Used to exit a loop or switch statement.
- case − Used in a switch statement to specify a possible match for the input value.
- chan − Used to create communication channels between goroutines.
- const − Used to define a constant value that cannot be changed.
- continue − Used to skip the current iteration of a loop and move to the next iteration.
- defer − Used to schedule a function call to be executed after the current function returns.
- else − Used to specify an alternative block of code to execute if the if condition is false.
- fallthrough − Used in a switch statement to specify that control will pass to the next case.
- for − Used to create a loop that repeats a block of code a specified number of times.
- func − Used to define a function that can be called from other parts of the program.
- go − Used to start a new goroutine.
- goto − Used to jump to a specific label within the current function.
- if − Used to execute a block of code only if a certain condition is true.
- import − Used to import a package into the program.
- interface − Used to define a set of methods that a type must implement.
- map − Used to define a set of key-value pairs.
- package − Used to define a package containing one or more Go source files.
- range − Used to iterate over an array, slice, sequence, map, or channel.
- return − Used to exit a function and return a value to the caller.
- select − Used to wait for a value to be sent to one of multiple channels.
- struct − Used to define a set of fields representing a complex data type.
- switch − Used to execute a block of code based on the value of an expression.
- type − Used to define a new data type.
- var − Used to declare a variable.
For example:
// Minh họa chương trình Go sử dụng từ khóa
// Từ khóa package được dùng để bao gồm main package trong chương trình
package main
// Từ khóa import được dùng để nhập "fmt" vào trong package
import "fmt"
// func được dùng để tạo hàm
func main() {
// Từ khóa var được dùng để tạo biến
// Pname, Lname, and Cname là các biến hợp lệ
var Pname = "Quantrimang"
var Lname = "Go Language"
var Cname = "Keywords"
fmt.Printf("Portal name: %s", Pname)
fmt.Printf("\nLanguage name: %s", Lname)
fmt.Printf("\nChapter name: %s", Cname)
}
Result:
Portal name: GeeksforGeeks
Language name: Go Language
Chapter name: Keywords
Whether you are a beginner or an experienced developer, mastering Golang keywords is an important step towards becoming a proficient Go programmer.