2022-10-31:以下go语言代码输出什么?A:map[];B:nil;C:Panic;D:编译错误。package mai
2023-06-13 09:14:40 时间
2022-10-31:以下go语言代码输出什么?A:map[];B:nil;C:Panic;D:编译错误。
package main
import "fmt"
func main() {
var m map[string]int
delete(m, "oh noes!")
fmt.Println(m)
}
答案选A。在 delete 函数的文档有说明:The delete built-in function deletes the element with the specified key (m[key]) from the map. If m is nil or there is no such element, delete is a no-op.这意思是没有元素的时候,啥都不做。
相关文章
- Go-Excelize API源码阅读(二十二)——SetAppProps(appProperties *AppProperties)
- 2022-09-02:以下go语言代码输出什么?A:9;B:11;C:编译错误;D:不确定。 package main import ( "fmt"
- Go-Excelize API源码阅读(十五)——SetSheetViewOptions
- 2022-10-18:以下go语言代码输出什么?A:panic;B:编译错误;C:moonfdd1。 package main import ( “fmt“ “
- Go-Excelize API源码阅读(二十七)——SetRowOutlineLevel、SetColOutlineLevel
- 2022-08-17:以下go语言代码输出什么?A:运行时 panic;B:32;C:编译错误;D:0。package main
- 读猿码系列——3. 从filebeat和go-stash深入日志收集及处理(filebeat篇)
- Go常见错误集锦之不正确的初始化slice方式会降低性能
- Go错误集锦 | map中因mutex使用不当导致的数据竞争
- 「Go工具箱」推荐一个变量调试神器:go-spew
- Go-标准库-strconv(一)
- Go-标准库-testing(四)
- Go-数据库驱动
- Go语言通过反射调用函数
- Go语言圣经-函数递归习题详解编程语言
- 深度探索Go语言与Redis结合(go-redis)
- 关键字在SQL Server中利用GO关键字实现更优化的操作(sqlserver中go)
- 便捷使用Go编程连接Redis(go连接redis)
- 去oracle之路探索从零开始的新挑战(go 连oracle)
- Go语言搭建Oracle数据库快速连接方法(go语言连接oracle)
- 新技术Go语言解析Oracle数据库日志(go解析oracle日志)