当前位置:网站首页>go_ keyword
go_ keyword
2022-06-24 21:06:00 【AcTarjan】
switch
- Look for a match case, Exit after execution switch
func judgeType(i interface{
}) {
switch i.(type) {
case bool:
fmt.Println("bool")
case int:
fmt.Println("int")
case string:
fmt.Println("string")
default:
fmt.Println("unknown")
}
}
select
- select It can only be used for channel The operation of ,channel Don't block , Then case It can be executed
- If there are more than one case Can be executed ,select One of them will be selected randomly and fairly , Others will not be executed
- If there is no executable case sentence , But there are default sentence , Then it will carry out default The action of
- If there is no executable case sentence , And there's no default sentence ,select Will block , Until some case It can be executed
ch := make(chan int,1)
select {
case <-ch:
fmt.Println(1)
case ch<-2:
fmt.Println(2)
default:
fmt.Println(3)
}
/******************* 2 *******************/
边栏推荐
- Handling of garbled JMeter response data - three solutions
- Summary of message protocol problems
- yeb_ Back first day
- 科创人·味多美CIO胡博:数字化是不流血的革命,正确答案藏在业务的田间地头
- "Super point" in "Meng Hua Lu", is the goose wronged?
- Camera rental management system based on qt+mysql
- C langage pour le déminage (version simplifiée)
- Docker deploy mysql5.7
- Berkeley, MIT, Cambridge, deepmind and other industry leaders' online lectures: towards safe, reliable and controllable AI
- Open programmable infrastructure (OPI) project, redefining dpu/ipu
猜你喜欢
![[performance tuning basics] performance tuning strategy](/img/83/be41a6a0c5c186d3fb3a120043c53f.jpg)
[performance tuning basics] performance tuning strategy

After idea installs these plug-ins, the code can be written to heaven. My little sister also has to arrange it

大一女生废话编程爆火!懂不懂编程的看完都拴Q了

Shrimp skin test surface treated

Basic concepts and definitions of Graphs

Map跟object 的区别

After screwing the screws in the factory for two years, I earned more than 10000 yuan a month by "testing" and counterattacked

Read all text from stdin to a string

物聯網?快來看 Arduino 上雲啦

Agency mode -- Jiangnan leather shoes factory
随机推荐
Leetcode (455) - distribute cookies
Static routing job
Berkeley, MIT, Cambridge, deepmind et d'autres grandes conférences en ligne: vers une IA sûre, fiable et contrôlable
Record a deletion bash_ Profile file
Berkeley, MIT, Cambridge, deepmind and other industry leaders' online lectures: towards safe, reliable and controllable AI
Internet of things? Come and see Arduino on the cloud
Implement the redis simple client customized based on socket
Leetcode(146)——LRU 缓存
The difference between RPC and restful
Responsibility chain mode -- through interview
图的基本概念以及相关定义
Why do we always "give up halfway"?
Rename and delete files
微信小程序自定义tabBar
基于QT+MySQL的相机租赁管理系统
Handling of garbled JMeter response data - three solutions
Read all text from stdin to a string
After a few years in the testing industry, do you still know a little?
网络安全审查办公室对知网启动网络安全审查
The Google File System (GFS) learning notes