if (some condition) --suppose this gets true
....
....
elseif (some condition)--this also gets false
...
...
else
... --this else condition becomes false
...
if (some condition)
..
else
..
endif-- stops execution when it gets here,doesnt moves on to next endif
endif
现在我想要做的是跳过其他部分。我正在跳过它,直到它获得endif关键字。但是当它在else部分获得第一个endif时它会停止执行。如何跳过该endif以使其与if的确切endif匹配。 它真的很令人困惑请帮忙...
答案 0 :(得分:3)
您需要直接获得条件逻辑:
magicNumber = 42
If magicNumber = 42 Then
wscript.echo "Magic number is 42!"
ElseIf magicNumber > 23 Then
wscript.echo "Magic number is more than 23"
Else
wscript.echo "Magic number is 23 or less"
If magicNumber <= 0
wscript.echo "Woah! Magic number is negative!"
else
wscript.echo "Phew, at least Magic number is not zero or negative"
End if
wscript.echo "Bye!"
End if
wscript.echo "End."
' Output:
' Magic number is 42!
' End.
因为第一个条件是True
,所以其他条件都不会被测试和执行。