循环测试:结果为空时的处理
当结果为空时,程序的循环是如何来处理呢?
以下为 Do ... Loop While 和 Do ... Loop Until 两种循环式下的处理。
示例1:
<script language="VBScript"> <!-- Dim ans Do ans = InputBox("请输入少于10的数字") If ans = "" Then Exit Do Loop While ans > 10 If ans <> "" Then MsgBox("正确!") Else MsgBox("结束") End If //--> </script>
示例2:
<script language="VBScript"> <!-- Dim ans Do ans = InputBox("请输入少于10的数字") If ans = "" Then Exit Do Loop Until ans < 10 If ans <> "" Then MsgBox("正确!") Else MsgBox("错误!") End If //--> </script>