当前位置:网站首页>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 *******************/
边栏推荐
- Static routing job
- Berkeley, MIT, Cambridge, deepmind and other industry leaders' online lectures: towards safe, reliable and controllable AI
- C语言实现扫雷(简易版)
- 传统的IO存在什么问题?为什么引入零拷贝的?
- Basic operation of sequence table
- Use the transparent [x] cross button image in the dialog
- Adding subscribers to a list using mailchimp's API V3
- Mr. Hu Bo, CIO of weiduomei, a scientific innovator: digitalization is a bloodless revolution, and the correct answer lies in the field of business
- 全上链哈希游戏dapp系统定制(方案设计)
- Leetcode (135) - distribute candy
猜你喜欢
Talking about the range of data that MySQL update will lock

Sequence stack version 1.0

"Ningwang" was sold and bought at the same time, and Hillhouse capital has cashed in billions by "selling high and absorbing low"
浅谈MySql update会锁定哪些范围的数据

云计算发展的 4 个阶段,终于有人讲明白了

Apple, Microsoft and Google will no longer fight each other. They will work together to do a big thing this year

"Super point" in "Meng Hua Lu", is the goose wronged?

How to apply agile development ideas to other work

Summary of message protocol problems

Bean lifecycle flowchart
随机推荐
DAPP system customization of full chain hash game (scheme design)
"Super point" in "Meng Hua Lu", is the goose wronged?
[multi thread performance tuning] multi thread lock optimization (Part 1): optimization method of synchronized synchronization lock
Agency mode -- Jiangnan leather shoes factory
Bridging mode -- law firm
JMeter installation plug-in, adding [email protected] -Perfmon metric collector listener steps
Summary of idea practical skills: how to rename a project or module to completely solve all the problems you encounter that do not work. It is suggested that the five-star collection be your daughter
Format method and parse method of dateformat class
2021-09-30
Sleep revolution - find the right length of rest
主数据建设的背景
虚拟化是什么意思?包含哪些技术?与私有云有什么区别?
Visitor model -- generation gap between young and middle-aged people
What does virtualization mean? What technologies are included? What is the difference with private cloud?
Grating diffraction
Apple, Microsoft and Google will no longer fight each other. They will work together to do a big thing this year
Second understanding permutation and combination
顺序栈遍历二叉树
顺序栈1.0版本
The AI for emotion recognition was "harbouring evil intentions", and Microsoft decided to block it!