当前位置:网站首页>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 *******************/
边栏推荐
- Open function
- Basic operation of sequence table
- 微信小程序中使用vant组件
- Camera rental management system based on qt+mysql
- 2021-09-30
- Hongxiang Yunteng is compatible with dragon lizard operating system, and the product runs stably
- An example illustrates restful API
- Interpreter mode -- formulas for dating
- Does the developer want to change to software testing?
- Second understanding permutation and combination
猜你喜欢
浅谈MySql update会锁定哪些范围的数据

伯克利、MIT、剑桥、DeepMind等业内大佬线上讲座:迈向安全可靠可控的AI

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

Berkeley, MIT, Cambridge, deepmind et d'autres grandes conférences en ligne: vers une IA sûre, fiable et contrôlable

Common data model (updating)

OSI notes sorting

基于QT+MySQL的相机租赁管理系统

物聯網?快來看 Arduino 上雲啦

After 5 months' test, it took 15K to come for an interview. When I asked, it was not worth even 5K. It was really

Enjoy yuan mode -- a large number of flying dragons
随机推荐
Bridging mode -- law firm
Leetcode (135) - distribute candy
Static routing job
NPM download speed is slow
等保备案是等保测评吗?两者是什么关系?
Enjoy yuan mode -- a large number of flying dragons
Internet of things? Come and see Arduino on the cloud
Format method and parse method of dateformat class
opds sql组件能不能将流程参数通过上下文传给下一个组件
Combination mode -- stock speculation has been cut into leeks? Come and try this investment strategy!
Freshman girls' nonsense programming is popular! Those who understand programming are tied with Q after reading
Dongyuhui is not enough to bring goods to "rescue" live broadcast
CVPR 2022 remembers Sun Jian! Tongji and Ali won the best student thesis award, and hekaiming was shortlisted
Learn to use a new technology quickly
Basic operation of sequence table
Haitai Advanced Technology | application of privacy computing technology in medical data protection
DX12引擎开发课程进度-这个课程到底讲到哪里了
Procedural life: a few things you should know when entering the workplace
It was Tencent who jumped out of the job with 26k. It really wiped my ass with sandpaper. It gave me a hand
Static routing job supplement