当前位置:网站首页>[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 .
边栏推荐
- Kingbasees v8r3 data security case - audit record clearing case
- About the writing method of SQL field "this includes" and "included in" strings
- Image editor for their AutoLayout environment
- oracle 控制文件的多路复用
- poj 3237 Tree(树链拆分)
- MMAP learning
- 冯唐“春风十里不如你”数字藏品,7月8日登录希壤!
- Parker驱动器维修COMPAX控制器维修CPX0200H
- regular expression
- Huawei game multimedia service calls the method of shielding the voice of the specified player, and the error code 3010 is returned
猜你喜欢
K210学习笔记(四) K210同时运行多个模型
递归查询多级菜单数据
每日刷题记录 (十四)
Oracle检查点队列–实例崩溃恢复原理剖析
Dbeaver executes multiple insert into error processing at the same time
Deployment of Jenkins under win7
Oracle checkpoint queue - Analysis of the principle of instance crash recovery
Teach yourself to train pytorch model to Caffe (I)
Making global exception handling classes with aspect
MySQL InnoDB Architecture Principle
随机推荐
Haas506 2.0 development tutorial - Alibaba cloud OTA - PAC firmware upgrade (only supports versions above 2.2)
Some things make feelings nowhere to put
The Blue Bridge Cup web application development simulation competition is open for the first time! Contestants fast forward!
ICMP introduction
Cross end solutions to improve development efficiency
他们主动布局(autolayout)环境的图像编辑器
An exception occurred in Huawei game multimedia calling the room switching method internal system error Reason:90000017
Making global exception handling classes with aspect
Huawei game multimedia service calls the method of shielding the voice of the specified player, and the error code 3010 is returned
初级软件测试必问面试题
Drawing HSV color wheel with MATLAB
场景化面试:关于分布式锁的十问十答
SecureCRT使用提示
大约SQL现场“这包括”与“包括在”字符串的写法
Sorting out the problems encountered in MySQL built by pycharm connecting virtual machines
Summary of data analysis steps
Objects in the list, sorted by a field
KingbaseES V8R3集群维护案例之---在线添加备库管理节点
冯唐“春风十里不如你”数字藏品,7月8日登录希壤!
EBS Oracle 11g cloning steps (single node)