当前位置:网站首页>[go record] start go language from scratch -- make an oscilloscope with go language (I) go language foundation
[go record] start go language from scratch -- make an oscilloscope with go language (I) go language foundation
2022-07-08 00:51:00 【Ah Dan of maker Association】
I participated in a challenge today , Starting from scratch GO Language , For a week GO Language development of a serial port oscilloscope .
I haven't been in contact with GO Language , It's just C/C++, Learn from scratch GO, expect 8 Fast hours .
Use this for learning videos : Learning video
GO Language benefits : Simple and easy to use .
Dachang road , Yes C The foundation is easy to take off .
The goal is
GO grammar :
GO Language variables
Be similar to C Enumeration of languages :
Returns two values :
init and import Guide pack
Be similar to include, stay GO It's called guide bag
Basic pointer ( Did you learn C You can skip )
defer( No define)
Finally execute in the form of stack .( It is roughly to set a stack in the function , Execute first, press in first , After the function runs , Out of the stack , The first is the last )
Follow the principle of "first in, second out" .
return The following statement is executed first .defer Finally, execute .
for loop :
len Calculate the length of the array :
The array length should match
// What is passed is reference passing , It's a pointer ( Similar to array name , The type is int[])
slice Four methods of :
%v Is to print out variables variable It means , Joint output [].
Four statements slice The way :
by make() add to
slice Slice addition and interception :
Capacity and length are different ,
The length is indeed 3, But capacity is an illegal pointer ptr Values outside ( from make The third parameter determines ), Want to operate the first one behind , Have to use append( Slice name [],2) It means appending a value to the slice name , by 2,
Reuse append( Slice name [],3) It can be added as the data of the fifth capacity , When it comes to the fifth or more , Reuse append( Slice name [],2) You can open up the length and capacity , The development size is the previous cap The capacity of ( Opened up at one time 5 individual , In an inch of land, an inch of gold flash Don't like to play like this )
copy function :
map Three declaration definitions of :
Now this is an empty map(==nil( Equivalent to NULL))
map usage :
边栏推荐
- Application practice | the efficiency of the data warehouse system has been comprehensively improved! Data warehouse construction based on Apache Doris in Tongcheng digital Department
- The underlying principles and templates of new and delete
- NVIDIA Jetson test installation yolox process record
- Play sonar
- ReentrantLock 公平锁源码 第0篇
- 爬虫实战(八):爬表情包
- [OBS] the official configuration is use_ GPU_ Priority effect is true
- C# 泛型及性能比较
- Analysis of 8 classic C language pointer written test questions
- 去了字节跳动,才知道年薪 40w 的测试工程师有这么多?
猜你喜欢
Play sonar
How does the markdown editor of CSDN input mathematical formulas--- Latex syntax summary
Analysis of 8 classic C language pointer written test questions
Codeforces Round #804 (Div. 2)(A~D)
QT adds resource files, adds icons for qaction, establishes signal slot functions, and implements
新库上线 | CnOpenData中国星级酒店数据
玩转Sonar
Where is the big data open source project, one-stop fully automated full life cycle operation and maintenance steward Chengying (background)?
Password recovery vulnerability of foreign public testing
1293_FreeRTOS中xTaskResumeAll()接口的实现分析
随机推荐
Prompt configure: error: required tool not found: libtool solution when configuring and installing crosstool ng tool
If an exception is thrown in the constructor, the best way is to prevent memory leakage?
Play sonar
Tencent security released the white paper on BOT Management | interpreting BOT attacks and exploring ways to protect
Cascade-LSTM: A Tree-Structured Neural Classifier for Detecting Misinformation Cascades(KDD20)
German prime minister says Ukraine will not receive "NATO style" security guarantee
【愚公系列】2022年7月 Go教学课程 006-自动推导类型和输入输出
Handwriting a simulated reentrantlock
Solution to the problem of unserialize3 in the advanced web area of the attack and defense world
tourist的NTT模板
FOFA-攻防挑战记录
QT adds resource files, adds icons for qaction, establishes signal slot functions, and implements
大数据开源项目,一站式全自动化全生命周期运维管家ChengYing(承影)走向何方?
Cascade-LSTM: A Tree-Structured Neural Classifier for Detecting Misinformation Cascades(KDD20)
paddle入门-使用LeNet在MNIST实现图像分类方法一
Fofa attack and defense challenge record
接口测试进阶接口脚本使用—apipost(预/后执行脚本)
华泰证券官方网站开户安全吗?
德总理称乌不会获得“北约式”安全保障
新库上线 | CnOpenData中华老字号企业名录