更好的比较操作 [英] Greater comparison operation

查看:71
本文介绍了更好的比较操作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我与两个数字进行比较


if(t.minimum.value t.maximum.value)...


但它总是正确的,除非最小值和最大值相同。为什么

当最小值小于最大值时不是假的?


O. Wyss


- -

跨平台应用程序:
http://wyoguide.sf.net/index.php?page=projectlist.php

I''ve this comparison with two numbers

if (t.minimum.value t.maximum.value) ...

yet it''s always true except when minimum and maximum are identical. Why
isn''t it false when minimum is smaller than maximum?

O. Wyss

--
Cross-platform applications:
http://wyoguide.sf.net/index.php?page=projectlist.php

推荐答案

2月14,下午6:59,Otto Wyss< otw ... @ bluewin.chwrote:
On Feb 14, 6:59 pm, Otto Wyss <otw...@bluewin.chwrote:

我与两个号码进行比较


如果(t.minimum.value t.maximum.value)......


但它总是正确的,除非最小值和最大值相同。

当最小值小于最大值时,为什么它不是假的?
I''ve this comparison with two numbers

if (t.minimum.value t.maximum.value) ...

yet it''s always true except when minimum and maximum are identical.
Why isn''t it false when minimum is smaller than maximum?



可能你的''数字''实际上是字符串而你的

比较是词汇。

Richard。

The odds are that your ''numbers'' are actually strings and your
comparison is lexical.

Richard.


Otto Wyss写道:
Otto Wyss wrote:

我已经这个与两个数字的比较


if(t.minimum.value t.maximum.value)...


但它是'除非最小值和最大值相同,否则始终为真。为什么

当最小值小于最大值时不是假的?
I''ve this comparison with two numbers

if (t.minimum.value t.maximum.value) ...

yet it''s always true except when minimum and maximum are identical. Why
isn''t it false when minimum is smaller than maximum?



试试


if(+ t.minimum.value + t.maximum.value)


如果有可能值是字符串而不是数字。


-

Ian Collins。

Try

if (+t.minimum.value +t.maximum.value)

If there is a chance the values are strings and not numbers.

--
Ian Collins.


Ian Collins写道:
Ian Collins wrote:

Otto Wyss写道:
Otto Wyss wrote:

>我与两个数字进行比较

if(t.minimum.value t.maximum .value)...

然而,除非最小值和最大值相同,否则它总是正确的。当最小值小于最大值时,为什么
不是假的?
>I''ve this comparison with two numbers

if (t.minimum.value t.maximum.value) ...

yet it''s always true except when minimum and maximum are identical. Why
isn''t it false when minimum is smaller than maximum?



尝试


if(+ t.minimum.value + t.maximum.value)

Try

if (+t.minimum.value +t.maximum.value)



我不敢相信,但它确实有效!

I can''t believe it, yet it works!


如果有可能值是字符串而不是数字。
If there is a chance the values are strings and not numbers.



如果我不得不使用它,我可能会不喜欢Javascript更多。


O. Wyss


-

跨平台应用程序:
http://wyoguide.sf.net/index.php?page= projectlist.php


这篇关于更好的比较操作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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