找回密码
 加入
搜索
查看: 1536|回复: 2

[系统综合] 逻辑问题,

[复制链接]
发表于 2013-3-16 22:31:28 | 显示全部楼层 |阅读模式
想写个白天运行某程序的简单逻辑,却搞不明白了,
应该是这样写吧,If 7 <= @HOUR And @HOUR <= 20 Then
但测试下来并没达到效果,必需用Or
改成这样 If 7 <= @HOUR Or @HOUR <= 20 Then

有高手能解释一下吗,我胡图了,
发表于 2013-3-16 23:46:38 | 显示全部楼层
回复 1# mhgd

不是吧?这个逻辑挺简单的呀,我写了一下
$i = @HOUR
For $i =0 To 23
        If 7 <= $i  And  $i <= 20 Then
                ConsoleWrite("When $i is " & $i & " It's Ture" & @CRLF)
        Else
                ConsoleWrite("When $i is " & $i & " It's False" & @CRLF)
        EndIf
Next
结果如下:
>"D:\Tools\AutoIt3\SciTE\..\autoit3.exe" /ErrorStdOut "D:\prj\Au3\test.au3"   
When $i is 0 It's False
When $i is 1 It's False
When $i is 2 It's False
When $i is 3 It's False
When $i is 4 It's False
When $i is 5 It's False
When $i is 6 It's False
When $i is 7 It's Ture
When $i is 8 It's Ture
When $i is 9 It's Ture
When $i is 10 It's Ture
When $i is 11 It's Ture
When $i is 12 It's Ture
When $i is 13 It's Ture
When $i is 14 It's Ture
When $i is 15 It's Ture
When $i is 16 It's Ture
When $i is 17 It's Ture
When $i is 18 It's Ture
When $i is 19 It's Ture
When $i is 20 It's Ture
When $i is 21 It's False
When $i is 22 It's False
When $i is 23 It's False
>Exit code: 0    Time: 0.536
 楼主| 发表于 2013-3-17 12:48:17 | 显示全部楼层
昨天测试出来了,
If 7 <= @HOUR And @HOUR <= 20 Then   必需加个绝对值,abs(@HOUR)
If 7 <= abs(@HOUR) And abs(@HOUR) <= 20 Then
您需要登录后才可以回帖 登录 | 加入

本版积分规则

QQ|手机版|小黑屋|AUTOIT CN ( 鲁ICP备19019924号-1 )谷歌 百度

GMT+8, 2024-12-25 23:41 , Processed in 0.075403 second(s), 21 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表