当前位置:网站首页>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 *******************/
边栏推荐
- Bridging mode -- law firm
- Selenium crawl notes
- 虚拟化是什么意思?包含哪些技术?与私有云有什么区别?
- Rip/ospf protocol notes sorting
- Sequence stack version 1.0
- Leetcode(135)——分发糖果
- Packaging_ Conversion between basic type and string type
- Combination mode -- stock speculation has been cut into leeks? Come and try this investment strategy!
- 顺序栈1.0版本
- Leetcode (135) - distribute candy
猜你喜欢

Bean lifecycle flowchart

Microsoft Certification (dynamic 365) test

Apple doesn't need money, but it has no confidence in its content

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

Leetcode(135)——分发糖果

Camera rental management system based on qt+mysql

When querying the database with Gorm, reflect: reflect flag. mustBeAssignable using unaddressable value

Prototype mode -- clone monster Army

基于QT+MySQL的相机租赁管理系统
浅谈MySql update会锁定哪些范围的数据
随机推荐
Haitai Advanced Technology | application of privacy computing technology in medical data protection
Variable setting in postman
Stackoverflow annual report 2022: what are developers' favorite databases?
Sequential stack traversal binary tree
Comprehensive comparison of the most popular packet capturing tools in the whole network
Interpreter mode -- formulas for dating
Can the OPDS SQL component pass process parameters to the next component through context
Open programmable infrastructure (OPI) project, redefining dpu/ipu
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
Shrimp skin test surface treated
Combination mode -- stock speculation has been cut into leeks? Come and try this investment strategy!
得物多活架构设计之路由服务设计
[普通物理] 光栅衍射
使用gorm查询数据库时reflect: reflect.flag.mustBeAssignable using unaddressable value
Responsibility chain mode -- through interview
等保备案是等保测评吗?两者是什么关系?
[multi thread performance tuning] multi thread lock optimization (Part 1): optimization method of synchronized synchronization lock
After idea installs these plug-ins, the code can be written to heaven. My little sister also has to arrange it
A/B测试助力游戏业务增长
Record a deletion bash_ Profile file