当前位置:网站首页>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
边栏推荐
- Didi open source Delta: AI developers can easily train natural language models
- 蓝桥杯单片机省赛第十一届
- Oracle的md5
- 向数据库中存入数组数据,代码出错怎么解决
- Recently, the weather has been extremely hot, so collect the weather data of Beijing, Shanghai, Guangzhou and Shenzhen last year, and make a visual map
- What is the logical structure of database file
- Oracle viewing locked tables and unlocking
- regular expression
- L'avènement de l'ère 5G, une brève discussion sur la vie passée et présente des communications mobiles
- Is the product of cancer prevention medical insurance safe?
猜你喜欢
Vite: configure IP access
蓝桥杯单片机省赛第十一届第一场
Qt插件之Qt Designer插件实现
0 foundation how to learn automated testing? Follow these seven steps step by step and you will succeed
The 8th Blue Bridge Cup single chip microcomputer provincial competition
High performance and low power cortex-a53 core board | i.mx8m Mini
PR zero foundation introductory guide note 2
集成底座方案演示说明
MD5 of Oracle
滴滴开源DELTA:AI开发者可轻松训练自然语言模型
随机推荐
Fourier series
Network connection mode of QT
《动手学深度学习》(二)-- 多层感知机
蓝桥杯单片机数码管技巧
The first game of the 11th provincial single chip microcomputer competition of the Blue Bridge Cup
蓝桥杯单片机省赛第六届
MD5 of Oracle
数据库文件逻辑结构形式指的是什么
Failed to upgrade schema, error: “file does not exist
Where can I buy cancer insurance? Which product is better?
潘多拉 IOT 开发板学习(HAL 库)—— 实验2 蜂鸣器实验(学习笔记)
Unity脚本的基础语法(6)-特定文件夹
[punch in] flip the string (simple)
The 7th Blue Bridge Cup single chip microcomputer provincial competition
Flutter中深入了解MaterialApp,常用属性解析
Fingertips life Chapter 4 modules and packages
SQL:常用的 SQL 命令
Oracle common SQL
[Li Kou brush questions] 15 Sum of three numbers (double pointer); 17. Letter combination of phone number (recursive backtracking)
C语言:逻辑运算和判断选择结构例题