我已经很难解决这个问题,但我很快就来了。在VBScript中,我无法阻止我的循环重复执行
这里是我的代码:
'attempts and completions loop
'attempts
do
do
Wscript.StdOut.WriteLine "How many attempts did " & QB & " throw: "
attempts = Wscript.StdIn.ReadLine
if IsNumeric(attempts) then
attempts = CInt(attempts)
else
Wscript.StdOut.Write "You did not enter a number. Please try again."
end if
loop while IsNumeric(attempts) = false
'completions
do
Wscript.StdOut.WriteLine "How many completed passes did " & QB & " throw for: "
completions = Wscript.StdIn.ReadLine
if IsNumeric(completions) then
attempts = CInt(completions)
else
Wscript.StdOut.Write "You did not enter a number. Please try again."
end if
loop while (completions) = false
if attempts > completions then
exit do
else
Wscript.StdOut.Writeline "Completions can not be more that attempts please try again."
end if
loop while attempts < completions
当我尝试比输入更多的落成,让我的愿望的结果。但是当我输入更多的尝试而不是完成时,它仍然会循环访问这段代码。我可以请帮助吗?
我认为缺少的则IsNumeric为(完工)只是复制/粘贴错字? 此外,当程序意外地循环时,它是否也显示“完成不能更多...”的消息还是只是循环? –