为什么Go没有三元运算符
生活随笔
收集整理的這篇文章主要介紹了
为什么Go没有三元运算符
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Why does Go not have the ?: operator?
為什么Go沒有?:運算符?
There is no ternary testing operation in Go.
Go中沒有三元測試操作。
You may use the following to achieve the same result:
您可以使用以下方法獲得相同的結果:
The reason ?: is absent from Go is that the language’s designers had seen the operation used too often to create impenetrably complex expressions.
Go缺少?:的原因是該語言的設計師發現該操作過于頻繁地用于創建難以理解的復雜表達式。
The if-else form, although longer, is unquestionably clearer.
if-else形式雖然更長,但無疑更清晰。
A language needs only one conditional control flow construct.
一種語言僅需要一個條件控制流構造。
總結
以上是生活随笔為你收集整理的为什么Go没有三元运算符的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Go语言 科学计算库 Gonum 学习1
- 下一篇: The directory '*' or