三元运算符:不好还是好习惯? [英] Ternary operator: bad or good practice?

查看:82
本文介绍了三元运算符:不好还是好习惯?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找不使用/不使用它的原因以及新颖的想法(在使用和替换中)。



复制:

I'm looking for reasons to use/not to use it and for original ideas (in their use and to replace them).


Duplicate:

  • To Ternary Or Not To Ternary

相关(但未解决所提出的问题):

Related (but does not address the question being asked):

  • Which coding style you use for ternary operator?

推荐答案

为了便于阅读,我只在适合80个字符的行中使用三元。

For the sake of readability, I only use a ternary if it fits into one 80-char line.

这篇关于三元运算符:不好还是好习惯?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆