当前位置:网站首页>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 *******************/
边栏推荐
- Intermediary model -- collaboration among departments
- Memo mode - game archiving
- Common member methods of the calendar class
- C語言實現掃雷(簡易版)
- Nifi fast authentication configuration
- Is the waiting insurance record a waiting insurance evaluation? What is the relationship between the two?
- After idea installs these plug-ins, the code can be written to heaven. My little sister also has to arrange it
- 物聯網?快來看 Arduino 上雲啦
- Visitor model -- generation gap between young and middle-aged people
- Second understanding permutation and combination
猜你喜欢
![[普通物理] 光栅衍射](/img/f3/965ff7cd3bb76b4f71b69b9d12ece3.png)
[普通物理] 光栅衍射

I feel that I am bald again when I help my children with their homework. I feel pity for my parents all over the world

Read all text from stdin to a string

Otaku can't save yuan universe

伯克利、MIT、劍橋、DeepMind等業內大佬線上講座:邁向安全可靠可控的AI

Record a deletion bash_ Profile file

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

Prototype mode -- clone monster Army

Design of routing service for multi Activity Architecture Design

Basic operation of sequence table
随机推荐
Is the waiting insurance record a waiting insurance evaluation? What is the relationship between the two?
Leetcode (455) - distribute cookies
Berkeley, MIT, Cambridge, deepmind et d'autres grandes conférences en ligne: vers une IA sûre, fiable et contrôlable
网络安全审查办公室对知网启动网络安全审查
Apple doesn't need money, but it has no confidence in its content
"Super point" in "Meng Hua Lu", is the goose wronged?
Visitor model -- generation gap between young and middle-aged people
刚购买了一个MYSQL数据库,提示已有实例,控制台登录实例要提供数据库账号,我如何知道数据库账号。
C语言实现扫雷(简易版)
Static routing job
Camera rental management system based on qt+mysql
Design of routing service for multi Activity Architecture Design
Format method and parse method of dateformat class
Can the OPDS SQL component pass process parameters to the next component through context
Berkeley, MIT, Cambridge, deepmind and other industry leaders' online lectures: towards safe, reliable and controllable AI
Comprehensive comparison of the most popular packet capturing tools in the whole network
Simpledateformat thread unsafe
Basic operation of sequence table
Sequence stack version 1.0
The Google File System (GFS) learning notes