VBScript中的或运算符

6

vbscript支持或运算符吗?

我想在vbscript中执行以下代码,请帮忙:

if a="address1" or b = "address2"
    then Response.Redirect("www.example.com")
endif

2
VBScript非常注重换行。需要将“then”保持在同一行与“if”一起使用。 - Tomalak
1
同时,在 end 和 if 之间要留一个空格,即 End if 而不是 endif。 - bugtussle
2个回答

12
你非常接近了:
If a = "address1" Or b = "address2" Then 
    Response.Redirect("www.example.com") 
End If

4

为了提高可读性,请使用括号...

If (a = "address1") Or (b = "address2") Then 
    Response.Redirect("www.example.com") 
End If

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接