当前位置:网站首页>Go language naming specification
Go language naming specification
2022-07-02 03:53:00 【UPythonFish】
go Language naming specification
One Variable definition specification
Go Function names in languages 、 Variable name 、 Constant names 、 Type name 、 Statement label and package name, etc , All follow a simple naming rule :
A name must have one letter (Unicode Letter ) Or start with an underscore , It can be followed by any number of letters 、 Number or underscore
Capital letters and lowercase letters are different :Name and name It's two different variables
Keywords and reserved words are not recommended as variable names
And there is only one project main package , You can't run with more or less . Learning foundation stage , You can have more than one project main function , But we must use file Form operation , Cannot run as a package .
// Hump body is recommended for variable definition
-AgeOfPerson go Language and java Language recommendation ,python Not recommended
-age_of_person Underline in , Not recommended (go Not recommended ,python recommend )
// go Name of file , Underline is recommended ( Refer to the source code )
-java In language : Hump is recommended for variables and file names
-Python in : It is recommended to underline variable names and file names
Two Keywords and reserved words
Go What are the key words in a language 25 individual ; Keywords cannot be used for custom names , It can only be used in specific grammatical structures .37 A reserved word , It mainly corresponds to built-in constants 、 Types and functions
// 25 Key words
break default func interface select
case defer go map struct
chan else goto package switch
const fallthrough if range type
continue for import return var
//37 A reserved word
Built-in Constants : true false iota nil
Built in type : int int8 int16 int32 int64
uint uint8 uint16 uint32 uint64 uintptr
float32 float64 complex128 complex64
bool byte rune string error
Built-in functions : make len cap new append copy close delete
complex real imag
panic recover
边栏推荐
- Raspberry pie GPIO pin controls traffic light and buzzer
- Failed to upgrade schema, error: “file does not exist
- [punch in] flip the string (simple)
- Unity脚本的基础语法(8)-协同程序与销毁方法
- Vite: configure IP access
- Influence of air resistance on the trajectory of table tennis
- 向数据库中存入数组数据,代码出错怎么解决
- 树莓派GPIO引脚控制红绿灯与轰鸣器
- What kind of interview is more effective?
- 2022-07-01: at the annual meeting of a company, everyone is going to play a game of giving bonuses. There are a total of N employees. Each employee has construction points and trouble points. They nee
猜你喜欢
QT designer plug-in implementation of QT plug-in
In wechat applet, the externally introduced JS is used in xwml for judgment and calculation
0 foundation how to learn automated testing? Follow these seven steps step by step and you will succeed
蓝桥杯单片机省赛第十届
Introduction to Robotics II. Forward kinematics, MDH method
[yolo3d]: real time detection of end-to-end 3D point cloud input
[designmode] builder model
Pandora IOT development board learning (RT thread) - Experiment 1 LED flashing experiment (learning notes)
蓝桥杯单片机省赛第七届
First acquaintance with string+ simple usage (II)
随机推荐
Analysis of the overall design principle of Nacos configuration center (persistence, clustering, information synchronization)
【无线图传】基于FPGA的简易无线图像传输系统verilog开发,matlab辅助验证
蓝桥杯单片机省赛第十届
Finally got byte offer. The 25-year-old inexperienced perception of software testing is written to you who are still confused
regular expression
蓝桥杯单片机数码管技巧
手撕——排序
Qt插件之Qt Designer插件实现
MD5 of Oracle
Oracle viewing locked tables and unlocking
Didi open source Delta: AI developers can easily train natural language models
Pandora IOT development board learning (RT thread) - Experiment 1 LED flashing experiment (learning notes)
蓝桥杯单片机省赛第十二届第一场
MySQL之账号管理
Monkey test
Raspberry pie GPIO pin controls traffic light and buzzer
[personal notes] PHP common functions - custom functions
跳出舒适区,5年点工转型自动化测试工程师,我只用了3个月时间
Basic syntax of unity script (6) - specific folder
The 8th Blue Bridge Cup single chip microcomputer provincial competition