2023-01-09:以下go语言代码输出什么?A:+Inf; B:zero; C:something else; D:does
2023-02-26 09:49:40 时间
2023-01-09:以下go语言代码输出什么?A:+Inf;B:zero;C:something else;D:doesn't compile。
package main
import (
"fmt"
"math"
)
func main() {
// Inf returns positive infinity if sign >= 0, negative infinity if sign < 0.
x := math.Inf(1)
switch {
case x < 0, x > 0:
fmt.Println(x)
case x == 0:
fmt.Println("zero")
default:
fmt.Println("something else")
}
}
答案选A。这道题考的不是语法,而是英语。根据注释 Inf returns positive infinity if sign >= 0, negative infinity if sign < 0.,即可得出答案。
相关文章
- 用过 mongodb 吧, 这三个大坑踩过吗?
- 教你配置windows上的windbg,linux上的lldb,打入clr内部这一篇就够了
- MongoDB 在评论中台的实践
- 使用mongodb作为Quartz.Net下的JobStore实现底层的持久化机制
- mongodb之使用explain和hint性能分析和优化
- mongodb 3.x 之实用新功能窥看[2] ——使用$lookup做多表关联处理
- mongodb 3.x 之实用新功能窥看[1] ——使用TTLIndex做Cache处理
- 双十一来了,别让你的mongodb宕机了
- GO语言开发环境搭建笔记
- PHP判断网络连通
- 开启phpMyAdmin的远程登录
- PHP_cURL初始化和执行方法
- PHP经典函数收集
- PHP所有函数列表
- php bbcode过滤
- php不使用中间变量交换两个变量的值
- 嵌入式:ARM异常中断指令SWI、BKPT、CLZ详解
- 嵌入式:ARM协处理器指令总结
- C++ 中的卷积神经网络 (CNN)
- 一个git仓库多个项目配置pre-commit代码校验