当前位置:网站首页>[Yugong series] go teaching course in July 2022 004 go code Notes
[Yugong series] go teaching course in July 2022 004 go code Notes
2022-07-05 21:52:00 【Yugong move code】
List of articles
Preface
1. The definition of annotation
Annotation is the interpretation and explanation of the code . The purpose is to make it easy for others and themselves to understand , You can see at a glance what this code is for . Correct program annotation generally includes preamble annotation and functional annotation . The main content of the preamble note includes the interface of the module 、 Description of data and function of modules . The main content of the functional annotation of the module includes the function of the program segment 、 The function of the statement and the state of the data .
2. The function of annotation
Comments are just for readability , Will not be compiled by the computer .
One 、Go code annotation
Go Language annotations are mainly divided into two categories , These are single line comments and multi line comments .
1. Single-line comments
Single line notes are abbreviated as line notes , Is the most common form of annotation , Can be used anywhere to //
The opening single line comment ;
Shortcut key :ctrl+c
// Add Addition of two numbers ( This line will be intercepted as a brief introduction )
// Precautions and principle of adding two numbers ( This line is a super detailed introduction )
func Add(n1,n2 int)int{
return n1+n2
}
2. Multiline comment
Multiline annotation is abbreviated as block annotation , With /*
start , And */
ending , And it can't be nested , Multiline annotations are generally used for package document description or block code fragments .
Shortcut key :shift+ctrl+c
/* regexp The package implements a simple library for regular expressions . The regular expression syntax accepted by the library is : regexp: concatenation { '|' concatenation } concatenation: { closure } closure: term [ '*' | '+' | '?' ] term: '^' '$' '.' character '[' [ '^' ] character-ranges ']' '(' regexp ')' */
package regexp
summary
The function of annotation in the program is to annotate and explain the program , Easy to read the source code . The compilation system will automatically ignore the comments when compiling the source code , Therefore, annotations have no effect on the function realization of the program . Add appropriate comments to the source code , It can improve the readability of the source code .
边栏推荐
- 华为游戏多媒体调用切换房间方法出现异常Internal system error. Reason:90000017
- Zhang Lijun: la pénétration de l’incertitude dépend de quatre « invariants»
- EL与JSTL注意事项汇总
- Cross end solutions to improve development efficiency
- Image editor for their AutoLayout environment
- DataGrid directly edits and saves "design defects"
- 华为快游戏调用登录接口失败,返回错误码 -1
- MySQL InnoDB Architecture Principle
- Codeforces 12D ball tree array simulation 3 sorting elements
- 大约SQL现场“这包括”与“包括在”字符串的写法
猜你喜欢
Defect detection - Halcon surface scratch detection
K210学习笔记(四) K210同时运行多个模型
Xlrd common operations
1.2 download and installation of the help software rstudio
Alibaba cloud award winning experience: build a highly available system with polardb-x
QML reported an error expected token ";", expected a qualified name ID
KingbaseES V8R3集群维护案例之---在线添加备库管理节点
Huawei game multimedia service calls the method of shielding the voice of the specified player, and the error code 3010 is returned
Emotional analysis of wechat chat records on Valentine's day based on Text Mining
Kingbasees v8r3 cluster maintenance case -- online addition of standby database management node
随机推荐
張麗俊:穿透不確定性要靠四個“不變”
Shell script, awk condition judgment and logic comparison &||
Cross end solutions to improve development efficiency
Dbeaver executes multiple insert into error processing at the same time
Four components of logger
Huawei fast game failed to call the login interface, and returned error code -1
使用Aspect制作全局异常处理类
EBS Oracle 11g 克隆步骤(单节点)
华为游戏多媒体服务调用屏蔽指定玩家语音方法,返回错误码3010
Parker driver maintenance COMPAX controller maintenance cpx0200h
SQL common syntax records
Zhang Lijun: penetrating uncertainty depends on four "invariants"
HDU 4391 paint the wall segment tree (water
An exception occurred in Huawei game multimedia calling the room switching method internal system error Reason:90000017
【愚公系列】2022年7月 Go教学课程 004-Go代码注释
sql常用语法记录
华为快游戏调用登录接口失败,返回错误码 -1
张丽俊:穿透不确定性要靠四个“不变”
AD637使用笔记
Zhang Lijun: la pénétration de l’incertitude dépend de quatre « invariants»