为什么1< 2 < 3正确评估,但3> 2> 1不? [英] Why does 1 < 2 < 3 evaluate correctly, but 3 > 2 > 1 doesn't?

查看:102
本文介绍了为什么1< 2 < 3正确评估,但3> 2> 1不?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

: 1 < 2 < 3
true
: 3 > 2 > 1
false
...
...
: 3 > 2 && 2 > 1
true

也许我真的在考虑问题,但是我认为它们都认为是正确的.为什么不呢?

Maybe I'm really over thinking things, but I would assume that they'd both evaluate to true. Why does it not?

推荐答案

因为1 < 2的计算结果为true,小于3
但是3 > 2(也将其评估为true)不大于1

Because 1 < 2 evaluates as true which is less than 3,
but 3 > 2 which also evaluates as true is NOT greater than 1

这篇关于为什么1&lt; 2 < 3正确评估,但3&gt; 2&gt; 1不?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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