找回密码
 加入
搜索
查看: 3138|回复: 1

While...WEnd

[复制链接]
发表于 2008-5-6 16:26:10 | 显示全部楼层 |阅读模式
While <表达式>
    其它语句
    ...
WEnd


表达式 若该表达式的值为真则重复执行循环体语句(以WEnd为结束标志),否则循环结束。


$sum = 0
While 1 ;use infinite loop since ExitLoop will get called
    $ans = InputBox("Running total=" & $sum, _
        "   Enter a positive number.  (A negative number exits)")
    If $ans < 0 Then ExitLoop
    $sum = $sum + $ans
WEnd
MsgBox(0,"The sum was", $sum)

象这个 While 1   这怎么才知道是真是假啊

[ 本帖最后由 amio 于 2008-5-6 17:16 编辑 ]
发表于 2008-5-6 16:40:30 | 显示全部楼层
非0即为真

While 1 为死循环

循环体中必须有循环出口的判断(ExitLoop)
您需要登录后才可以回帖 登录 | 加入

本版积分规则

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

GMT+8, 2024-4-20 03:42 , Processed in 0.067774 second(s), 19 queries .

Powered by Discuz! X3.5 Licensed

© 2001-2024 Discuz! Team.

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