我已經很難解決這個問題,但我很快就來了。在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爲(完工)只是複製/粘貼錯字? 此外,當程序意外地循環時,它是否也顯示「完成不能更多...」的消息還是隻是循環? –