Home >Backend Development >Golang >What are multi-line comments in go language?
Multi-line comments in the Go language start with [/*] and end with [*/], and cannot be nested, such as [/*multi-line comments*/]. Multi-line comments are typically used to document package descriptions or to comment code snippets into blocks.
The operating environment of this article: windows10 system, Go 1.11.2, thinkpad t480 computer.
(Learning video sharing: Programming video)
Comments in Go language are mainly divided into two categories, namely single-line comments and multi-line comments.
Single-line comments are referred to as line comments, which are the most common form of comments. Single-line comments starting with // can be used anywhere;
Multi-line comments are referred to as block comments, starting with /*. And ends with */, and cannot be nested. Multi-line comments are generally used for package documentation descriptions or code snippets that are commented into blocks.
The format of single-line comments is as follows
//单行注释
The format of multi-line comments is as follows
/* 第一行注释 第二行注释 ... */
Each package should have related comments, and use the package statement to declare the package Add corresponding comments before the name to briefly explain the functions and functions of the package.
Related recommendations: golang tutorial
The above is the detailed content of What are multi-line comments in go language?. For more information, please follow other related articles on the PHP Chinese website!